BuildCommand constructor

BuildCommand({
  1. required String rootPath,
  2. required List<ConstructMaker> constructs,
  3. required FileSystem fs,
  4. required Logger logger,
  5. RoutesHandler? routesHandler,
})

Implementation

BuildCommand({
  required this.rootPath,
  required this.constructs,
  required this.fs,
  required this.logger,
  RoutesHandler? routesHandler,
}) : routesHandler = routesHandler ??
          RoutesHandler(
            fs: fs,
            rootPath: rootPath,
          ) {
  argParser
    ..addOption(
      'flavor',
      abbr: 'f',
      help: 'The flavor to use for the app (case-sensitive)',
    )
    ..addFlag(
      'release',
      help: '(Default) Whether to run in release mode. Disabled hot reload, '
          'debugger, and logger',
      negatable: false,
    )
    ..addFlag(
      'profile',
      help: 'Whether to run in profile mode. Enables logger, '
          'but disables hot reload and debugger',
      negatable: false,
    )
    ..addOption(
      'type',
      allowedHelp: {
        for (final type in GenerateConstructType.values)
          type.name: type.description,
      },
      hide: true,
      allowed: GenerateConstructType.values.map((e) => e.name),
      defaultsTo: GenerateConstructType.build.name,
      help: 'Which constructs to generate',
    )
    ..addMultiOption(
      'dart-define',
      abbr: 'D',
      help: 'Additional key-value pairs that will be available as constants.',
      valueHelp: 'BASE_URL=https://api.example.com',
    )
    ..addMultiOption(
      'dart-define-from-file',
      help: 'A file containing additional key-value '
          'pairs that will be available as constants.',
      valueHelp: '.env',
    );
}