run method

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

Runs this command.

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

Implementation

@override
Future<int> run() async {
  final analyzer = ProjectAnalyzer(Directory.current);
  if (!analyzer.isFlutterProject) {
    usageException('Not a Flutter project (missing flutter dependency in pubspec.yaml).');
  }
  final version = await VersionManager.getPackageVersion();
  final config = {
    'version': version,
    'directories': {'components': 'lib/widgets', 'examples': 'lib/examples'},
    'theme': {'material3': true}
  };
  final file = File('plexaverse.json');
  file.writeAsStringSync(const JsonEncoder.withIndent('  ').convert(config));
  stdout.writeln('Initialized plexaverse.json');
  return 0;
}