10
10
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
11
11
//.title~
12
12
13
+ // ignore_for_file: invalid_use_of_visible_for_testing_member
14
+
13
15
import 'package:df_gen_core/df_gen_core.dart' ;
14
16
import 'package:df_generate_dart_models_core/df_generate_dart_models_core.dart' ;
15
17
import 'package:df_screen_core/df_screen_core.dart' ;
@@ -96,8 +98,7 @@ Future<void> genScreenBindingsApp(
96
98
'Looking for Dart files..' ,
97
99
);
98
100
final filePathStream0 = PathExplorer (inputPath).exploreFiles ();
99
- final filePathStream1 =
100
- filePathStream0.where ((e) => _isAllowedFileName (e.path));
101
+ final filePathStream1 = filePathStream0.where ((e) => _isAllowedFileName (e.path));
101
102
List <FilePathExplorerFinding > findings;
102
103
try {
103
104
findings = await filePathStream1.toList ();
@@ -126,11 +127,13 @@ Future<void> genScreenBindingsApp(
126
127
printWhite,
127
128
'Reading template at: $template ...' ,
128
129
);
129
- final result = await MdTemplateUtility .i.readTemplateFromPathOrUrl (
130
- template,
131
- );
130
+ final result = await MdTemplateUtility .i
131
+ .readTemplateFromPathOrUrl (
132
+ template,
133
+ )
134
+ .value;
132
135
133
- if (result.isErr) {
136
+ if (result.isErr () ) {
134
137
spinner.stop ();
135
138
_print (
136
139
printRed,
@@ -225,8 +228,7 @@ bool _isAllowedFileName(String e) {
225
228
226
229
extension _ClassInsightExtension on ClassInsight <GenerateScreenBindings > {
227
230
StringCaseType get stringCaseType {
228
- return StringCaseType .values.valueOf (annotation.keyStringCase) ??
229
- StringCaseType .CAMEL_CASE ;
231
+ return StringCaseType .values.valueOf (annotation.keyStringCase) ?? StringCaseType .CAMEL_CASE ;
230
232
}
231
233
}
232
234
@@ -241,17 +243,14 @@ String _screenSegment(ClassInsight<ModelGenerateScreenBindings> insight) {
241
243
final path = insight.annotation.path ?? '' ;
242
244
final screenSegment = p.joinAll (
243
245
[
244
- path.isNotEmpty && path.startsWith (RegExp (r'[\\/]' ))
245
- ? path.substring (1 )
246
- : path,
246
+ path.isNotEmpty && path.startsWith (RegExp (r'[\\/]' )) ? path.substring (1 ) : path,
247
247
screenKey,
248
248
],
249
249
);
250
250
return screenSegment;
251
251
}
252
252
253
- final _interpolator =
254
- TemplateInterpolator <ClassInsight <GenerateScreenBindings >>(
253
+ final _interpolator = TemplateInterpolator <ClassInsight <GenerateScreenBindings >>(
255
254
{
256
255
'___SCREEN_KEY___' : _screenKey,
257
256
'___SCREEN_SEGMENT___' : _screenSegment,
@@ -276,20 +275,16 @@ final _interpolator =
276
275
return '/$screenSegment ' ;
277
276
},
278
277
'___IS_ACCESSIBLE_ONLY_IF_LOGGED_IN_AND_VERIFIED___' : (insight) {
279
- return (insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false )
280
- .toString ();
278
+ return (insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ).toString ();
281
279
},
282
280
'___IS_ACCESSIBLE_ONLY_IF_LOGGED_IN___' : (insight) {
283
- return (insight.annotation.isAccessibleOnlyIfLoggedIn ?? false )
284
- .toString ();
281
+ return (insight.annotation.isAccessibleOnlyIfLoggedIn ?? false ).toString ();
285
282
},
286
283
'___IS_ACCESSIBLE_ONLY_IF_LOGGED_OUT___' : (insight) {
287
- return (insight.annotation.isAccessibleOnlyIfLoggedOut ?? false )
288
- .toString ();
284
+ return (insight.annotation.isAccessibleOnlyIfLoggedOut ?? false ).toString ();
289
285
},
290
286
'___IS_ALWAYS_ACCESSIBLE___' : (insight) {
291
- final a =
292
- insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
287
+ final a = insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
293
288
final b = insight.annotation.isAccessibleOnlyIfLoggedIn ?? false ;
294
289
final c = insight.annotation.isAccessibleOnlyIfLoggedOut ?? false ;
295
290
if (a && b) {
@@ -326,10 +321,8 @@ final _interpolator =
326
321
return b.toString ();
327
322
},
328
323
'___IP0___' : (insight) {
329
- final params = insight.annotation.internalParameters
330
- ? .map ((e) => FieldUtils .ofOrNull (e))
331
- .nonNulls ??
332
- {};
324
+ final params =
325
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
333
326
if (params.isNotEmpty) {
334
327
final a = params.map ((e) {
335
328
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -354,10 +347,8 @@ final _interpolator =
354
347
}
355
348
},
356
349
'___IP1___' : (insight) {
357
- final params = insight.annotation.internalParameters
358
- ? .map ((e) => FieldUtils .ofOrNull (e))
359
- .nonNulls ??
360
- {};
350
+ final params =
351
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
361
352
if (params.isNotEmpty) {
362
353
final a = params.map ((e) {
363
354
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -374,10 +365,8 @@ final _interpolator =
374
365
}
375
366
},
376
367
'___IP2___' : (insight) {
377
- final params = insight.annotation.internalParameters
378
- ? .map ((e) => FieldUtils .ofOrNull (e))
379
- .nonNulls ??
380
- {};
368
+ final params =
369
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
381
370
if (params.isNotEmpty) {
382
371
final a = params.map ((e) {
383
372
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -391,10 +380,8 @@ final _interpolator =
391
380
}
392
381
},
393
382
'___QP0___' : (insight) {
394
- final params = insight.annotation.queryParameters
395
- ? .map ((e) => FieldUtils .ofOrNull (e))
396
- .nonNulls ??
397
- {};
383
+ final params =
384
+ insight.annotation.queryParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
398
385
if (params.isNotEmpty) {
399
386
final a = params.map ((e) {
400
387
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -419,10 +406,8 @@ final _interpolator =
419
406
}
420
407
},
421
408
'___QP1___' : (insight) {
422
- final params = insight.annotation.queryParameters
423
- ? .map ((e) => FieldUtils .ofOrNull (e))
424
- .nonNulls ??
425
- {};
409
+ final params =
410
+ insight.annotation.queryParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
426
411
if (params.isNotEmpty) {
427
412
final a = params.map ((e) {
428
413
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -436,10 +421,8 @@ final _interpolator =
436
421
}
437
422
},
438
423
'___QP2___' : (insight) {
439
- final params = insight.annotation.queryParameters
440
- ? .map ((e) => FieldUtils .ofOrNull (e))
441
- .nonNulls ??
442
- {};
424
+ final params =
425
+ insight.annotation.queryParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
443
426
if (params.isNotEmpty) {
444
427
final a = params.map ((e) {
445
428
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
0 commit comments