This PowerShell script automates the creation of a structured Flutter project with a clean architecture approach. It generates necessary packages, folders, and files based on user input, making it easier to start a new Flutter project.
- Initializes a new Flutter project
- Generates domain entities and repository structure
- Supports JSON-based entity and property definitions
- Creates clean architecture components like models, mappers, and services for the repo and provider & screen for the features
- Create also a lauch configuration for VScode and the main to execute the project
- Adds essential dependencies for Flutter development
Before running the script, ensure you have:
- Flutter installed on your machine
- A valid JSON file with entity definitions
- PowerShell installed on your system
-
Run the script in PowerShell
.\flutter_structure_creation_script.ps1
-
Provide the required details when prompted:
- Project name
- Project path
- Main theme name
- Entities and properties
-
The script will:
- Create a new Flutter project
- Generate the necessary package structure
- Set up domain entities, repository, and services
- Configure required dependencies
The script will generate the following structure:
project_name/
│── packages/
│ ├── domain_entities/
| | ├── pubspec.yaml
| | ├── analysis_options
│ │ ├── lib/
│ │ │ ├── src/
│ │ ├── domain_entities.dart
│ ├── $theme_repository/
| | ├── pubspec.yaml
| | ├── analysis_options
│ │ ├── lib/
│ │ │ ├── src/
│ │ │ │ ├── models/
│ │ │ │ ├── mappers/
│ │ │ │ ├── services/
│ │ │ ├── repository.dart
│ ├── component_library/
| | ├── pubspec.yaml
| | ├── analysis_options
| | │── example/ -> StoryBook
│ │ ├── lib/
│ │ │ ├── src/
│ │ ├── component_library.dart
| ├── features
| | ├── $theme_list
| | | ├── pubspec.yaml
| | | ├── analysis_options
| | | ├── lib/
| | | | ├── src/
| | | | ├── $theme_list.dart
| | | | | ├── lib/
| | | | | | ├── provider/
| | | | | | ├── screen/
The script automatically installs the following dependencies:
equatablefor entity equalityflutter_lintsfor lintingstorybook_flutterfor UI component previews
- JSON files containing entity definitions must be placed in:
packages/repository/lib/src/assets/data - The JSON format should be:
{ "EntityName": [ { "property1": "value", "property2": "value" } ] }