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 {
  print("๐Ÿงช Running build_runner...");

  final result = await Process.run(
    "dart",
    ["pub", "run", "build_runner", "build", "--delete-conflicting-outputs"],
    runInShell: true,
  );

  if (result.exitCode != 0) {
    print("โŒ Failed to generate files");
    print(result.stderr);
    return;
  }

  print("โœ… Code generation completed");
}