@@ -24,6 +24,7 @@ part 'all_types.g.dart';
24
24
path: 'enhanced-enum-route/:requiredEnumField' ),
25
25
TypedGoRoute <StringRoute >(path: 'string-route/:requiredStringField' ),
26
26
TypedGoRoute <UriRoute >(path: 'uri-route/:requiredUriField' ),
27
+ TypedGoRoute <IterableRoute >(path: 'iterable-route' ),
27
28
])
28
29
@immutable
29
30
class AllTypesBaseRoute extends GoRouteData {
@@ -33,7 +34,6 @@ class AllTypesBaseRoute extends GoRouteData {
33
34
Widget build (BuildContext context, GoRouterState state) =>
34
35
const BasePage <void >(
35
36
dataTitle: 'Root' ,
36
- param: null ,
37
37
);
38
38
}
39
39
@@ -290,17 +290,69 @@ class UriRoute extends GoRouteData {
290
290
);
291
291
}
292
292
293
+ class IterableRoute extends GoRouteData {
294
+ IterableRoute ({
295
+ this .intIterableField,
296
+ this .doubleIterableField,
297
+ this .stringIterableField,
298
+ this .boolIterableField,
299
+ this .enumIterableField,
300
+ this .intListField,
301
+ this .doubleListField,
302
+ this .stringListField,
303
+ this .boolListField,
304
+ this .enumListField,
305
+ this .intSetField,
306
+ this .doubleSetField,
307
+ this .stringSetField,
308
+ this .boolSetField,
309
+ this .enumSetField,
310
+ });
311
+
312
+ final Iterable <int >? intIterableField;
313
+ final List <int >? intListField;
314
+ final Set <int >? intSetField;
315
+
316
+ final Iterable <double >? doubleIterableField;
317
+ final List <double >? doubleListField;
318
+ final Set <double >? doubleSetField;
319
+
320
+ final Iterable <String >? stringIterableField;
321
+ final List <String >? stringListField;
322
+ final Set <String >? stringSetField;
323
+
324
+ final Iterable <bool >? boolIterableField;
325
+ final List <bool >? boolListField;
326
+ final Set <bool >? boolSetField;
327
+
328
+ final Iterable <SportDetails >? enumIterableField;
329
+ final List <SportDetails >? enumListField;
330
+ final Set <SportDetails >? enumSetField;
331
+
332
+ @override
333
+ Widget build (BuildContext context, GoRouterState state) =>
334
+ const BasePage <String >(
335
+ dataTitle: 'IterableRoute' ,
336
+ );
337
+
338
+ Widget drawerTile (BuildContext context) => ListTile (
339
+ title: const Text ('IterableRoute' ),
340
+ onTap: () => go (context),
341
+ selected: GoRouter .of (context).location == location,
342
+ );
343
+ }
344
+
293
345
class BasePage <T > extends StatelessWidget {
294
346
const BasePage ({
295
347
required this .dataTitle,
296
- required this .param,
348
+ this .param,
297
349
this .queryParam,
298
350
this .queryParamWithDefaultValue,
299
351
super .key,
300
352
});
301
353
302
354
final String dataTitle;
303
- final T param;
355
+ final T ? param;
304
356
final T ? queryParam;
305
357
final T ? queryParamWithDefaultValue;
306
358
@@ -352,6 +404,32 @@ class BasePage<T> extends StatelessWidget {
352
404
requiredUriField: Uri .parse ('https://dart.dev' ),
353
405
uriField: Uri .parse ('https://dart.dev' ),
354
406
).drawerTile (context),
407
+ IterableRoute (
408
+ intIterableField: < int > [1 , 2 , 3 ],
409
+ doubleIterableField: < double > [.3 , .4 , .5 ],
410
+ stringIterableField: < String > ['quo usque tandem' ],
411
+ boolIterableField: < bool > [true , false , false ],
412
+ enumIterableField: < SportDetails > [
413
+ SportDetails .football,
414
+ SportDetails .hockey,
415
+ ],
416
+ intListField: < int > [1 , 2 , 3 ],
417
+ doubleListField: < double > [.3 , .4 , .5 ],
418
+ stringListField: < String > ['quo usque tandem' ],
419
+ boolListField: < bool > [true , false , false ],
420
+ enumListField: < SportDetails > [
421
+ SportDetails .football,
422
+ SportDetails .hockey,
423
+ ],
424
+ intSetField: < int > {1 , 2 , 3 },
425
+ doubleSetField: < double > {.3 , .4 , .5 },
426
+ stringSetField: < String > {'quo usque tandem' },
427
+ boolSetField: < bool > {true , false },
428
+ enumSetField: < SportDetails > {
429
+ SportDetails .football,
430
+ SportDetails .hockey,
431
+ },
432
+ ).drawerTile (context),
355
433
],
356
434
)),
357
435
body: Center (
0 commit comments