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;
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。