Skip to content

warn if accidentally opting out of null safety #58430

@goderbauer

Description

@goderbauer

This lint warns if a package or file is accidentally opted out of null safety. As far as I know, there are two ways to opt out of null safety and the lint should trigger on both:

  • opting a specific .dart file out of null safety by using // @dart = 2.9 syntax with a version number <2.12
  • specifying a min SDK version in the pubspec.yaml of less then 2.12

Background: We are currently migrating all remaining code in the https://github.com/flutter/flutter repository to null safety (see flutter/flutter#84014). Once that is done, it should be illegal to add packages or files to the repository that have opted out of null safety. This lint would be enabled in the repository-wide analysis_options.yaml file to enforce that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions