Thank you for using this extension! This guide will walk you through the steps required to set up the necessary dependencies and ensure the smooth functioning of the extension in your Flutter project.
Required Dependencies
To use this extension, you need to add the following dependencies to your project:
1. Dependencies (Required Libraries)
Add these dependencies in your pubspec.yaml file:
dependencies:
flutter_bloc: any
freezed_annotation: any
get_it: any
injectable: any
internet_connection_checker: any
dev_dependencies:
build_runner: any
freezed: any
injectable_generator: any
json_serializable: any
How to Use MG: Generate Clean Architecture
1. Open Command Palette
Press Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (Mac) to open the Command Palette in Visual Studio Code.
2. Search for MG
In the search bar, type MG to find the extension command.
3. Choose the Architecture
Select the architecture type, such as "MG: Add Clean Architecture", to set up a ready-made clean architecture for your project.
4. Enter Feature Name
After selecting the architecture, you will be prompted to enter the feature name (e.g., User, Product, Order).
5. Enter Feature Response
Once you’ve entered the feature name, you will need to specify the response for the feature. This could be a JSON structure or a custom response model.
6. Choose CRUD Operations
You will then be asked to choose the CRUD operations you want to implement. You can select one or more operations:
Create
Read
Read All
Update
Delete
7. Automatic Setup
After completing the steps above, the extension will automatically generate the core architecture files and the feature you selected.
It will ask to also Build Runner to complete any necessary setup, ensuring all files are generated and ready to use.
8. Enjoy Your Clean Architecture
You will now have a ready-made, clean architecture with the selected feature and the CRUD operations you’ve chosen. The extension will handle most of the setup, saving you time.
How to Use MG: Create Model from JSON
1. Right-click on a Folder in the Explorer panel.
2. Select the option MG: Create Model from JSON.
3. Follow the prompts to enter the model name and paste the JSON response.
Additional Notes
Build Runner: The extension uses Build Runner to generate necessary files and configurations. Ensure that you run the appropriate build commands in your terminal to complete the setup process.
Customization: You can customize the generated files as per your project's specific requirements. The extension is designed to give you a solid starting point for a clean architecture setup with Flutter.
Conclusion
This extension is designed to save you time by automatically setting up a clean architecture and CRUD operations for your Flutter project. With just a few simple commands, you can quickly add structured features to your application, leaving you more time to focus on development!