inconsistent_language_version_override
Parts must have exactly the same language version override as the library.
Description
#The analyzer produces this diagnostic when a part file has a language version override comment that specifies a different language version than the one being used for the library to which the part belongs.
Example
#Given a part file named part.dart
that contains the following:
// @dart = 2.14
part of 'test.dart';
The following code produces this diagnostic because the parts of a library must have the same language version as the defining compilation unit:
// @dart = 2.15
part 'part.dart';
Common fixes
#Remove the language version override from the part file, so that it implicitly uses the same version as the defining compilation unit:
part of 'test.dart';
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。