ambiguous_export
The name '{0}' is defined in the libraries '{1}' and '{2}'.
Description
#The analyzer produces this diagnostic when two or more export directives cause the same name to be exported from multiple libraries.
Example
#Given a file a.dart
containing
dart
class C {}
And a file b.dart
containing
dart
class C {}
The following code produces this diagnostic because the name C
is being
exported from both a.dart
and b.dart
:
dart
export 'a.dart';
export 'b.dart';
Common fixes
#If none of the names in one of the libraries needs to be exported, then remove the unnecessary export directives:
dart
export 'a.dart';
If all of the export directives are needed, then hide the name in all except one of the directives:
dart
export 'a.dart';
export 'b.dart' hide C;
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。