flutter_clean library
Introduction
The flutter_clean is a package that helps to generate files according to this dataflow:
Generation result. Folders structure:
Entry point
After generation the new feature you will be got a file that names: <FeatureName>_builder.dart
. There is our entry point.
Example:
class NewFeatureBuilder {
static NewFeaturePage build() {
final dataSource = NewFeatureDataSource();
final repository = NewFeatureRepository(dataSource);
final usecase = NewFeatureUsecase(repository);
final viewModel = NewFeatureViewModel(usecase);
return NewFeaturePage(viewModel: viewModel);
}
}
To use a new feature you just need to call <FeatureName>Buidler.build()
this method will return <FeatureName>Page
with all dependencies
Generator
Example:
flutter pub run flutter_clean --name NewFeature --output lib/src/features
Feature naming convention:
-n example
--name example
-n Example
--name Example
-n ExampleFeature
--name ExampleFeature
Output parameter is optional. Default path is: lib/features
.
-o lib/src/features
--output lib/src/features