invalid_export_of_internal_element_indirectly
The member '{0}' can't be exported as a part of a package's public API, but is indirectly exported as part of the signature of '{1}'.
Description
#The analyzer produces this diagnostic when a public library exports a
top-level function with a return type or at least one parameter type that
is marked with the internal
annotation.
Example
#Given a file a.dart
in the src
directory that contains the
following:
import 'package:meta/meta.dart';
@internal
typedef IntFunction = int Function();
int f(IntFunction g) => g();
The following code produces this diagnostic because the function f
has a
parameter of type IntFunction
, and IntFunction
is only intended to be
used internally:
export 'src/a.dart' show f;
Common fixes
#If the function must be public, then make all the types in the function's signature public types.
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。