addNewApps method

Future<void> addNewApps(
  1. String pathApps,
  2. String appsName
)

Implementation

Future<void> addNewApps(String pathApps, String appsName) async {
  await FlutterHelper.run('create --template=package "$pathApps"');

  join(pathApps, 'pubspec.yaml').write('''name: $appsName
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: ../../core

dev_dependencies:
dev_dependency_manager:
  path: ../../core/packages/dev_dependency_manager

flutter:
uses-material-design: true
''');

  deleteDir(join(pathApps, 'lib'), recursive: true);
  deleteDir(join(pathApps, 'test'), recursive: true);

  createDir(join(pathApps, 'lib'), recursive: true);
  createDir(join(pathApps, 'test'), recursive: true);

  touch(join(pathApps, 'test', '.gitkeep'), create: true);

  join(pathApps, 'lib', 'locator.dart').write('''//
// Generated file. Edit just you manually add or delete a page.
//

void setupLocatorApps${appsName.pascalCase}() {

}''');

  StatusHelper.generated(pathApps);
  StatusHelper.generated(join(pathApps, 'lib', 'locator.dart'));
}