addNewFeature method
Implementation
Future<void> addNewFeature(
String pathFeature, String featureName, String appsName) async {
await FlutterHelper.run('create --template=package "$pathFeature"');
join(pathFeature, 'pubspec.yaml').write('''name: $featureName
description: A new Flutter package project.
version: 0.0.1
publish_to: "none"
environment:
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"
dependencies:
flutter:
sdk: flutter
core:
path: ${appsName.isEmpty ? "../../core" : "../../../../core"}
dev_dependencies:
dev_dependency_manager:
path: ${appsName.isEmpty ? "../../core/packages/dev_dependency_manager" : "../../../../core/packages/dev_dependency_manager"}
flutter:
uses-material-design: true
''');
deleteDir(join(pathFeature, 'lib'), recursive: true);
deleteDir(join(pathFeature, 'test'), recursive: true);
createDir(join(pathFeature, 'lib'), recursive: true);
createDir(join(pathFeature, 'test'), recursive: true);
touch(join(pathFeature, 'test', '.gitkeep'), create: true);
join(pathFeature, 'lib', 'locator.dart').write('''//
// Generated file. Edit just you manually add or delete a page.
//
void setupLocatorFeature${featureName.pascalCase}() {
}''');
StatusHelper.generated(pathFeature);
StatusHelper.generated(join(pathFeature, 'lib', 'locator.dart'));
}