import_of_legacy_library_into_null_safe
The library '{0}' is legacy, and shouldn't be imported into a null safe library.
Description
#The analyzer produces this diagnostic when a library that is null safe imports a library that isn't null safe.
Example
#Given a file a.dart
that contains the following:
dart
// @dart = 2.9
class A {}
The following code produces this diagnostic because a library that null safe is importing a library that isn't null safe:
dart
import 'a.dart';
A? f() => null;
Common fixes
#If you can migrate the imported library to be null safe, then migrate it and update or remove the migrated library's language version.
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。