Dio Cubit Starter
A brick to generate a clean architecture based starter structure utilizing dio for network calls along with dependency injection and cubit state management.
📌 Essential Information
This brick will generate a pubspec.yaml
file, a .env
file and a lib
folder with all its contents - you don't have to manually add any packages. Optionally, the brick will allow you to setup auto_route if you wish to use that package for navigation.
Note: This brick will store your secrets (in this case the API base url) within a .env
file and generate a subsequent env.g.dart
file. Do not check these files onto your version control.
🚀 Usage
In the root of your project, run the following:
mason make dio_cubit_starter --on-conflict overwrite
This command fetches the required pub packages and begins generating the freezed files after the brick has been made.
🧑💻 Variables
Variable | Type | Default | Description |
---|---|---|---|
name | string | StarterApp | Name of the app. This will be the landing screen |
api_url | string | (empty) | Base url of your API |
use_auto_route | boolean | false | Whether to generate a router file for configuration |
💼 Output
|-- lib
|-- core
|-- injection
|-- env.dart
|-- env.g.dart
|-- injection.dart
|-- module.dart
|-- util
|-- constants.dart
|-- failures.dart
|-- router #if <use_auto_route> is true
|-- routes.dart
|-- routes.gr.dart
|-- features
|-- <name>
|-- cubit
|-- <name>_cubit.dart
|-- <name>_cubit.freezed.dart
|-- <name>_state.dart
|-- presentation
|-- pages
|-- <name>_page.dart
|-- widgets
|-- <name>_widget.dart
|-- repository
|-- <name>_repository.dart
|-- i_<name>_repository.dart
|-- main.dart
|-- pubspec.yaml
|-- .env