export_legacy_symbol
The symbol '{0}' is defined in a legacy library, and can't be re-exported from a library with null safety enabled.
Description
#The analyzer produces this diagnostic when a library that was opted in to null safety exports another library, and the exported library is opted out of null safety.
Example
#Given a library that is opted out of null safety:
dart
// @dart = 2.8
String s;
The following code produces this diagnostic because it's exporting symbols from an opted-out library:
dart
export 'optedOut.dart';
class C {}
Common fixes
#If you're able to do so, migrate the exported library so that it doesn't need to opt out:
dart
String? s;
If you can't migrate the library, then remove the export:
dart
class C {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。