run method

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

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<void> run() async {
  /// Запрашиваем путь для будущего BLoC'а
  final currentDirectory = "Текущая директория";
  final pathToBloc = getUserInput<String>(
    helpPhrase: "Введите путь для создание BLoC'а",
    defaultValue: currentDirectory,
  );

  /// Запрашиваем название для будущего блока
  final blocName = getUserInput<String>(
    helpPhrase: "Введите название BLoC'а",
    defaultValue: "Sample",
  );

  late final Directory directory;
  if (pathToBloc == currentDirectory) {
    directory = Directory.current;
  } else {
    directory = Directory(pathToBloc);
  }

  await generateBLoCSamples(directory, blocName);
}