jt_flutter_cli 0.0.9 jt_flutter_cli: ^0.0.9 copied to clipboard
A command-line tool that simplifies auto-code generation. Fully flexible, allowing you to generate a feature and widget for your Flutter applications.
Introduction #
A command-line tool that simplifies auto-code generation. Allowing you to generate a feature, widget, model, and API call code for your Flutter applications.
Features #
- Feature code generation (Basic structure with classes)
- Widget code generation
- Model code generation
- GET method API call code generation
- POST method API call code generation
Flutter Compatibility #
Package version | Dart version | Flutter version | Boilerplate version |
---|---|---|---|
0.0.9 | 3.2.6 | 3.16.0 - 3.19.3 | 3.16.9 |
0.0.8 | 3.2.6 | 3.16.0 - 3.19.3 | 3.16.9 |
0.0.7 | 3.2.6 | 3.16.0 - 3.19.3 | 3.16.9 |
0.0.6 | 3.2.6 | 3.16.0 - 3.19.3 | 3.16.9 |
0.0.5 | 3.2.6 | 3.16.0 - 3.19.3 | 3.16.9 |
0.0.4 | 3.2.6 | 3.16.0 - 3.19.3 | 3.16.9 |
0.0.3 | 3.2.6 | 3.16.0 - 3.19.3 | 3.16.9 |
0.0.2 | 3.2.6 | 3.16.0 - 3.19.3 | 3.16.9 |
Getting Started #
To integrate the package into your Flutter project, follow these steps:
Add Dependency #
Add the following dependency to your pubspec.yaml file:
dependencies:
jt_flutter_cli: ^0.0.9
Then run:
flutter pub get
Usage #
Create new feature:
flutter pub run jt_flutter_cli create feature {name_of_feature}
In the above configuration, the package is creating a new feature that is available in the lib/feature/name_of_feature path.
It will generate the name_of_feature folder, which has the dart files and the domain, presentation, and data folders as shown below.
.
├── ...
├── name_of_feature
│ ├── data
│ │ ├── data_source
│ │ │ └── name_of_feature_data_source.dart
│ │ │ └── name_of_feature_data_source_impl.dart
│ │ ├── repository
│ │ │ └── name_of_feature_repo_impl.dart
│ │ │ └── mock_name_of_feature_repo_impl.dart
│ ├── domain
│ │ ├── repositories
│ │ │ └── name_of_feature_repo.dart
│ ├── presentation
│ │ ├── bloc
│ │ │ └── name_of_feature_bloc.dart
│ │ │ └── name_of_feature_data_event.dart
│ │ │ └── name_of_feature_data_state.dart
│ │ ├── screen
│ │ │ └── name_of_feature_screen.dart
│ │ └── name_of_feature_page.dart
└── ...
Create new widget:
flutter pub run jt_flutter_cli create widget {name_of_widget}
It will prompt the user with the following question:
- Do you want to create a common widget or a feature widget? (common/feature)
- common: Widget will be created inside the folder lib/core/ui/widgets
- feature: It will prompt the user to enter the feature name, and the widget will be created inside the respective feature's folder at lib/feature/name_of_feature/presentation/screen/widgets
Create new model:
flutter pub run jt_flutter_cli create model {model_name} {feature_name} {json_file_path}
Add GET API call:
flutter pub run jt_flutter_cli Add get-api-call {API_end_point} {API_name}
It will prompt the user with the following questions for GET API call:
-
Enter feature name:
-
Does this API have request query parameters? (Y/N):
- Y : It will ask for json file path
- N : It will skip this question and move to next question
-
Enter request json file path:
-
Does this API have response body? (Y/N):
- Y : It will ask for json file path
- N : It will skip this question and move to next question
-
Enter response json file path:
-
Do you want to add shimmer to this API call? (Y/N):
- Y : It will generate the bloc state for showing shimmer UI in screen
- N : It will generate code to call base bloc event for showing progress indicator UI in dialog with no dismissible dialog
Add POST API call:
flutter pub run jt_flutter_cli Add post-api-call {API_end_point} {API_name}
It will prompt the user with the following questions for POST API call:
-
Enter feature name:
-
Does this API have request body? (Y/N):
- Y : It will ask for json file path
- N : It will skip this question and move to next question
-
Enter request json file path:
-
Does this API have response body? (Y/N):
- Y : It will ask for json file path
- N : It will skip this question and move to next question
-
Enter response json file path:
-
Do you want to add shimmer to this API call? (Y/N):
- Y : It will generate the bloc state for showing shimmer UI in screen
- N : It will generate code to call base bloc event for showing progress indicator UI in dialog with no dismissible dialog