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 {
  final selection = Select(
    prompt: 'What would you like to generate?',
    options: [
      'Page',
      'Smart Component',
      'Dumb Component',
      'Repository',
      'Entity',
      'Localization Key'
    ],
  ).interact();

  switch (selection) {
    case 0:
      await GeneratePageCommand().runInteractive();
      break;
    case 1:
      await GenerateSmartCommand().runInteractive();
      break;
    case 2:
      await GenerateDumbCommand().runInteractive();
      break;
    case 3:
      await GenerateRepositoryCommand().runInteractive();
      break;
    case 4:
      await GenerateEntityCommand().runInteractive();
      break;
    case 5:
      await GenerateL10nCommand().runInteractive();
      break;
  }
}