@@ -24,6 +24,7 @@ part 'all_types.g.dart';
2424 path: 'enhanced-enum-route/:requiredEnumField' ),
2525 TypedGoRoute <StringRoute >(path: 'string-route/:requiredStringField' ),
2626 TypedGoRoute <UriRoute >(path: 'uri-route/:requiredUriField' ),
27+ TypedGoRoute <IterableRoute >(path: 'iterable-route' ),
2728])
2829@immutable
2930class AllTypesBaseRoute extends GoRouteData {
@@ -33,7 +34,6 @@ class AllTypesBaseRoute extends GoRouteData {
3334 Widget build (BuildContext context, GoRouterState state) =>
3435 const BasePage <void >(
3536 dataTitle: 'Root' ,
36- param: null ,
3737 );
3838}
3939
@@ -290,17 +290,69 @@ class UriRoute extends GoRouteData {
290290 );
291291}
292292
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+
293345class BasePage <T > extends StatelessWidget {
294346 const BasePage ({
295347 required this .dataTitle,
296- required this .param,
348+ this .param,
297349 this .queryParam,
298350 this .queryParamWithDefaultValue,
299351 super .key,
300352 });
301353
302354 final String dataTitle;
303- final T param;
355+ final T ? param;
304356 final T ? queryParam;
305357 final T ? queryParamWithDefaultValue;
306358
@@ -352,6 +404,32 @@ class BasePage<T> extends StatelessWidget {
352404 requiredUriField: Uri .parse ('https://dart.dev' ),
353405 uriField: Uri .parse ('https://dart.dev' ),
354406 ).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),
355433 ],
356434 )),
357435 body: Center (
0 commit comments