Skip to content

Remove unsafe implicit cast warnings in Flutter code base #28588

@kasperl

Description

@kasperl

The Flutter analysis options currently contain:

strong_mode_down_cast_composite: ignore

Enabling those warnings leads to >100 warnings in the Flutter code base like these:

[warning] Unsafe implicit cast from 'Map<dynamic, dynamic>' to 'Map<String, dynamic>'. 
[warning] Unsafe implicit cast from '(ByTooltipMessage) → Finder' to '(SerializableFinder) → Finder'.
...

I suspect that a lot of these will require changes to the Flutter code base, but we should make sure that the type system isn't making this unnecessarily hard.

Reproduction steps:

   $ git clone https://github.com/flutter/flutter.git
   $ cd flutter
   $ bin/flutter update-packages
   <<comment out the strong_mode_down_cast_composite in .analysis_options_repo>>
   $ bin/flutter analyze --flutter-repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).customer-flutter

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions