@@ -42,13 +42,10 @@ class TizenCreateCommand extends CreateCommand {
4242 'app-type' ,
4343 allowed: < String > ['ui' , 'service' , 'multi' ],
4444 allowedHelp: < String , String > {
45- 'ui' :
46- '(default) Generate an application with a graphical user interface '
47- 'that runs in the foreground.' ,
48- 'service' :
49- 'Generate a service application that runs in the background.' ,
50- 'multi' :
51- 'Generate a multi-project application that consists of both UI and service parts.' ,
45+ 'ui' : '(default) Generate an application with a graphical user interface '
46+ 'that runs in the foreground.' ,
47+ 'service' : 'Generate a service application that runs in the background.' ,
48+ 'multi' : 'Generate a multi-project application that consists of both UI and service parts.' ,
5249 },
5350 help: 'Select a type of application template.' ,
5451 );
@@ -63,10 +60,8 @@ class TizenCreateCommand extends CreateCommand {
6360 return stringArg ('template' ) == 'plugin' ? 'cpp' : 'csharp' ;
6461 }
6562
66- Directory get _tizenTemplates => globals.fs
67- .directory (Cache .flutterRoot)
68- .parent
69- .childDirectory ('templates' );
63+ Directory get _tizenTemplates =>
64+ globals.fs.directory (Cache .flutterRoot).parent.childDirectory ('templates' );
7065
7166 Directory get _flutterTemplates => globals.fs
7267 .directory (Cache .flutterRoot)
@@ -76,15 +71,21 @@ class TizenCreateCommand extends CreateCommand {
7671
7772 /// See: [CreateCommand._getProjectType] in `create.dart`
7873 bool get _shouldGeneratePlugin {
79- FlutterProjectType ? template;
74+ FlutterTemplateType ? template;
8075 final String ? templateArgument = stringArg ('template' );
8176 if (templateArgument != null ) {
82- template = FlutterProjectType .fromCliName (templateArgument);
77+ final ParsedFlutterTemplateType ? templateType = ParsedFlutterTemplateType .fromCliName (
78+ templateArgument,
79+ );
80+ template = switch (templateType) {
81+ RemovedFlutterTemplateType () || null => null ,
82+ FlutterTemplateType () => templateType,
83+ };
8384 }
8485 if (projectDir.existsSync () && projectDir.listSync ().isNotEmpty) {
8586 template = determineTemplateType ();
8687 }
87- return template == FlutterProjectType .plugin;
88+ return template == FlutterTemplateType .plugin;
8889 }
8990
9091 @override
@@ -158,7 +159,7 @@ class TizenCreateCommand extends CreateCommand {
158159 bool pluginExampleApp = false ,
159160 bool printStatusWhenWriting = true ,
160161 bool generateMetadata = true ,
161- FlutterProjectType ? projectType,
162+ FlutterTemplateType ? projectType,
162163 }) async {
163164 if (pluginExampleApp) {
164165 // Reset to the updated identifier for the example app.
@@ -255,12 +256,8 @@ class TizenCreateCommand extends CreateCommand {
255256 }
256257
257258 final String templateName = template == 'app' ? '$appType -app' : template;
258- if (! _tizenTemplates
259- .childDirectory (templateName)
260- .childDirectory (tizenLanguage)
261- .existsSync ()) {
262- throwToolExit (
263- 'Could not locate a template: $templateName /$tizenLanguage ' );
259+ if (! _tizenTemplates.childDirectory (templateName).childDirectory (tizenLanguage).existsSync ()) {
260+ throwToolExit ('Could not locate a template: $templateName /$tizenLanguage ' );
264261 }
265262 }
266263
@@ -355,19 +352,14 @@ class TizenCreateCommand extends CreateCommand {
355352 // Copy application template to the flutter_tools/templates directory.
356353 // Even if the requested template type is plugin, an app template is
357354 // required for generating the example app.
358- final Directory appTemplate =
359- _tizenTemplates.childDirectory ('$appType -app' );
355+ final Directory appTemplate = _tizenTemplates.childDirectory ('$appType -app' );
360356 _copyDirectoryIfExists (
361357 appTemplate.childDirectory ('cpp' ),
362- _flutterTemplates
363- .childDirectory ('app_shared' )
364- .childDirectory ('tizen-cpp.tmpl' ),
358+ _flutterTemplates.childDirectory ('app_shared' ).childDirectory ('tizen-cpp.tmpl' ),
365359 );
366360 _copyDirectoryIfExists (
367361 appTemplate.childDirectory ('csharp' ),
368- _flutterTemplates
369- .childDirectory ('app_shared' )
370- .childDirectory ('tizen-csharp.tmpl' ),
362+ _flutterTemplates.childDirectory ('app_shared' ).childDirectory ('tizen-csharp.tmpl' ),
371363 );
372364 _copyDirectoryIfExists (
373365 appTemplate.childDirectory ('lib' ),
@@ -378,15 +370,11 @@ class TizenCreateCommand extends CreateCommand {
378370 final Directory pluginTemplate = _tizenTemplates.childDirectory ('plugin' );
379371 _copyDirectoryIfExists (
380372 pluginTemplate.childDirectory ('cpp' ),
381- _flutterTemplates
382- .childDirectory ('plugin' )
383- .childDirectory ('tizen-cpp.tmpl' ),
373+ _flutterTemplates.childDirectory ('plugin' ).childDirectory ('tizen-cpp.tmpl' ),
384374 );
385375 _copyDirectoryIfExists (
386376 pluginTemplate.childDirectory ('csharp' ),
387- _flutterTemplates
388- .childDirectory ('plugin' )
389- .childDirectory ('tizen-csharp.tmpl' ),
377+ _flutterTemplates.childDirectory ('plugin' ).childDirectory ('tizen-csharp.tmpl' ),
390378 );
391379
392380 // Apply patches if found.
0 commit comments