Skip to main content

invalid_language_version_override

The Dart language version override comment can't be followed by any non-whitespace characters.

The Dart language version override comment must be specified with a version number, like '2.0', after the '=' character.

The Dart language version override comment must be specified with an '=' character.

The Dart language version override comment must be specified with exactly two slashes.

The Dart language version override comment must be specified with the word 'dart' in all lower case.

The Dart language version override number can't be prefixed with a letter.

The Dart language version override number must begin with '@dart'.

The language version override can't specify a version greater than the latest known language version: {0}.{1}.

The language version override must be specified before any declaration or directive.

Description

#

The analyzer produces this diagnostic when a comment that appears to be an attempt to specify a language version override doesn't conform to the requirements for such a comment. For more information, see Per-library language version selection.

Example

#

The following code produces this diagnostic because the word dart must be lowercase in such a comment and because there's no equal sign between the word dart and the version number:

dart
// @Dart 2.13

Common fixes

#

If the comment is intended to be a language version override, then change the comment to follow the correct format:

dart
// @dart = 2.13