Line data Source code
1 : import 'package:very_good_cli/src/commands/commands.dart'; 2 : import 'package:very_good_cli/src/commands/create/templates/templates.dart'; 3 : 4 : /// {@template very_good_create_flutter_plugin_command} 5 : /// A [CreateSubCommand] for creating Flutter plugins. 6 : /// {@endtemplate} 7 : class CreateFlutterPlugin extends CreateSubCommand with Publishable, OrgName { 8 : /// {@macro very_good_create_flutter_plugin_command} 9 1 : CreateFlutterPlugin({ 10 : required super.logger, 11 : required super.generatorFromBundle, 12 : required super.generatorFromBrick, 13 : }) { 14 2 : argParser.addMultiOption( 15 : 'platforms', 16 : help: 'The platforms supported by the plugin. By default, all platforms ' 17 : 'are enabled. Example: --platforms=android,ios', 18 1 : defaultsTo: ['android', 'ios', 'web', 'linux', 'macos', 'windows'], 19 1 : allowed: ['android', 'ios', 'web', 'linux', 'macos', 'windows'], 20 1 : allowedHelp: { 21 : 'android': 'The plugin supports the Android platform.', 22 : 'ios': 'The plugin supports the iOS platform.', 23 : 'web': 'The plugin supports the Web platform.', 24 : 'linux': 'The plugin supports the Linux platform.', 25 : 'macos': 'The plugin supports the macOS platform.', 26 : 'windows': 'The plugin supports the Windows platform.', 27 : }, 28 : ); 29 : } 30 : 31 1 : @override 32 : String get name => 'flutter_plugin'; 33 : 34 1 : @override 35 : String get description => 'Generate a Very Good Flutter plugin.'; 36 : 37 1 : @override 38 1 : Template get template => FlutterPluginTemplate(); 39 : 40 1 : @override 41 : Map<String, dynamic> getTemplateVars() { 42 1 : final vars = super.getTemplateVars(); 43 : 44 2 : final platforms = argResults['platforms'] as List<String>; 45 : 46 1 : vars['platforms'] = platforms; 47 : 48 : return vars; 49 : } 50 : }