Skip to main content

invalid_export_of_internal_element

The member '{0}' can't be exported as a part of a package's public API.

Description

#

The analyzer produces this diagnostic when a public library exports a declaration that is marked with the internal annotation.

Example

#

Given a file a.dart in the src directory that contains:

dart
import 'package:meta/meta.dart';

@internal class One {}

The following code, when found in a public library produces this diagnostic because the export directive is exporting a name that is only intended to be used internally:

dart
export 'src/a.dart';

Common fixes

#

If the export is needed, then add a hide clause to hide the internal names:

dart
export 'src/a.dart' hide One;

If the export isn't needed, then remove it.