execute method

  1. @override
Future<void> execute()
override

Implementation

@override
Future<void> execute() async {
  final lib = Directory('lib');
  if (lib.existsSync()) {
    final arch = findCurrentArchitecture();
    if (arch == null) {
      var choice = UserInput.menu(options: [
        "Clean Architecture - BLoC - Feature wise",
        "MVVM - Provider - Feature wise",
      ], prompt: "Choose architecture pattern (example:1)");
      print("");
      blueLog("Initializing your project...");
      print("");
      switch (choice) {
        case 1:
          await _initArchitecture(
            structure: TddCleanStructure(),
            dependencies:
                "dartz flutter_bloc injectable freezed_annotation get_it dio intl go_router",
            devDependencies:
                "build_runner freezed injectable_generator mocktail",
          );
          break;
        case 2:
          await _initArchitecture(
            structure: MvvmStructure(),
            dependencies:
                "provider injectable freezed_annotation get_it dio intl go_router",
            devDependencies:
                "build_runner freezed injectable_generator mocktail",
          );
          break;
        default:
          print("Choice not found");
          break;
      }
    } else {
      if (arch == "tdd-brf") {
        showWarning("tdd clean", "brf");
      } else if (arch == "mvc-grl") {
        showWarning('mvc', "grl");
      } else if (arch == "mvvm-feature") {
        showWarning('mvvm', "feature");
      }
    }
  } else {
    redLog("[ERROR] lib folder not found");
  }
}