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
class C {}
And a file b.dart
containing
class C {}
The following code produces this diagnostic because the name C
is being exported from both a.dart
and b.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:
export 'a.dart';
If all of the export directives are needed, then hide the name in all except one of the directives:
export 'a.dart';
export 'b.dart' hide C;
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.