Skip to content

(Dart) Support Dart's new Null Safety type system #2550

@srawlins

Description

@srawlins

Describe the issue

Dart's new Null Safety language feature introduces some new keywords and a new way to specify types:

  • late and required are new keywords

  • Never is a new type found in dart:core

  • (almost) all types can be suffixed with a ? to indicate a nullable type. For example, in:

    f(int x) { ... }
    g(int? x) { ... }

    f is a function which accepts a non-null int parameter, and g accepts a nullable int parameter.

Which language seems to have the issue?

Dart.

Are you using highlight or highlightAuto?

Either.

Sample Code to Reproduce

late int x;
f({required int? y}) {}
const List<Never> z = [];

Expected behavior

late and required should be highlighted as keywords. int? should highlight the same as int. Never should be highlighted like the other built-in types.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugenhancementAn enhancement or new featuregood first issueShould be easier for first time contributorshelp welcomeCould use help from communitylanguage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions