The Flutter Feature Scaffolder is a Visual Studio Code extension designed to boost productivity by quickly scaffolding new features for Flutter applications using Clean Architecture. It automates the creation of a consistent directory and file structure for new features, including the setup for data, domain, and presentation layers according to Clean Architecture principles.
- Scaffold New Flutter Feature: Generates a new feature structure with all necessary layers and files, including
index.dart
files for easy exporting and importing. - Clean Architecture Compliant: Structures created by the extension follow the Clean Architecture guidelines, promoting a scalable, testable, and maintainable codebase.
- BLoC Pattern: Supports the Business Logic Component (BLoC) pattern for state management within the presentation layer.
Using the Flutter Feature Scaffolder to generate a new feature named feature_name
results in the creation of the following directory and file structure within your Flutter project:
lib/
└── features/
│ ├── feature_name/
│ │ // Data Layer
│ │ ├── data/
│ │ │ ├── data_sources/
│ │ │ │ ├── remote_data_source.dart // handles remote data operations
│ │ │ │ ├── local_data_source.dart // manages local data storage
│ │ │ │ └── index.dart // exports data_sources
│ │ │ ├── models/
│ │ │ │ └── index.dart // exports models
│ │ │ ├── repositories/
│ │ │ │ ├── feature_name_repository_impl.dart // feature-specific repository implementation
│ │ │ │ └── index.dart // exports repositories
│ │ └── index.dart // exports data layer
│ │ // Domain Layer
│ │ ├── domain/
│ │ │ ├── entities/
│ │ │ │ └── index.dart // exports entities
│ │ │ ├── repositories/
│ │ │ │ ├── feature_name_repository.dart // abstract definition of the repository
│ │ │ │ └── index.dart // exports repositories
│ │ │ └── use_cases/
│ │ │ │ └── index.dart // exports use cases
│ │ └── index.dart // exports domain layer
│ │ // Presentation Layer
│ │ ├── presentation/
│ │ │ ├── bloc/
│ │ │ │ ├── feature_name_bloc.dart // BLoC for state management
│ │ │ │ └── index.dart // exports BLoCs
│ │ │ ├── pages/
│ │ │ │ ├── feature_name_page.dart // feature-specific pages
│ │ │ │ └── index.dart // exports pages
│ │ │ └── widgets/
│ │ │ │ └── index.dart // exports widgets
│ │ └── index.dart // exports presentation layer
│ └── index.dart // exports feature
- Data Layer: Manages data (both local and remote) and includes models and repository implementations.
- Domain Layer: Contains the core business logic, including entities and abstract repository definitions.
- Presentation Layer: Handles everything related to the UI, including state management (BLoC), pages, and widgets.
Each index.dart
file is designed to export all Dart files within its respective directory, simplifying imports across the feature.
- Visual Studio Code
- Flutter SDK
- Dart SDK
- Open Visual Studio Code.
- Navigate to the Extensions view by clicking on the square icon on the sidebar or pressing
Ctrl+Shift+X
(Cmd+Shift+X
on macOS). - Search for
Flutter Feature Scaffolder
. - Click on Install.
- Open your Flutter project in Visual Studio Code.
- Press
Ctrl+Shift+P
(Cmd+Shift+P
on macOS) to open the Command Palette. - Type
Scaffold Flutter Feature
and press Enter. - Enter the name of the feature you wish to scaffold when prompted.
- The extension will create a new feature structure under
lib/src/features/[your_feature_name]
.
This extension does not require any specific settings to be adjusted.
For a list of known issues, please visit the GitHub issues page.
We welcome contributions and suggestions! Please see the CONTRIBUTING.md file for guidelines on how to contribute.
- Bug fixes in key bindings
If you encounter any problems or have suggestions, please open an issue on the GitHub issues page.
This project is licensed under the MIT License - see the LICENSE file for details.