Commit a5419341 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by Flutter GitHub Bot

enable lint prefer_for_elements_to_map_fromIterable (#47726)

parent d1349f69
...@@ -143,7 +143,7 @@ linter: ...@@ -143,7 +143,7 @@ linter:
- prefer_final_fields - prefer_final_fields
- prefer_final_in_for_each - prefer_final_in_for_each
- prefer_final_locals - prefer_final_locals
# - prefer_for_elements_to_map_fromIterable # not yet tested - prefer_for_elements_to_map_fromIterable
- prefer_foreach - prefer_foreach
# - prefer_function_declarations_over_variables # not yet tested # - prefer_function_declarations_over_variables # not yet tested
- prefer_generic_function_type_aliases - prefer_generic_function_type_aliases
......
...@@ -51,11 +51,9 @@ class _GalleryAppState extends State<GalleryApp> { ...@@ -51,11 +51,9 @@ class _GalleryAppState extends State<GalleryApp> {
// For a different example of how to set up an application routing table // For a different example of how to set up an application routing table
// using named routes, consider the example in the Navigator class documentation: // using named routes, consider the example in the Navigator class documentation:
// https://docs.flutter.io/flutter/widgets/Navigator-class.html // https://docs.flutter.io/flutter/widgets/Navigator-class.html
return Map<String, WidgetBuilder>.fromIterable( return <String, WidgetBuilder>{
kAllGalleryDemos, for (final GalleryDemo demo in kAllGalleryDemos) demo.routeName: demo.buildRoute,
key: (dynamic demo) => '${(demo as GalleryDemo).routeName}', };
value: (dynamic demo) => (demo as GalleryDemo).buildRoute,
);
} }
@override @override
......
...@@ -579,9 +579,7 @@ final Map<GalleryDemoCategory, List<GalleryDemo>> kGalleryCategoryToDemos = ...@@ -579,9 +579,7 @@ final Map<GalleryDemoCategory, List<GalleryDemo>> kGalleryCategoryToDemos =
}, },
); );
final Map<String, String> kDemoDocumentationUrl = final Map<String, String> kDemoDocumentationUrl = <String, String>{
Map<String, String>.fromIterable( for (final GalleryDemo demo in kAllGalleryDemos)
kAllGalleryDemos.where((GalleryDemo demo) => demo.documentationUrl != null), if (demo.documentationUrl != null) demo.routeName: demo.documentationUrl,
key: (dynamic demo) => (demo as GalleryDemo).routeName, };
value: (dynamic demo) => (demo as GalleryDemo).documentationUrl,
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment