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:
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:
export 'src/a.dart';
Common fixes
#
If the export is needed, then add a
hide
clause to hide the internal
names:
export 'src/a.dart' hide One;
If the export isn't needed, then remove it.
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.