invalid_use_of_internal_member
The member '{0}' can only be used within its package.
Description
#The analyzer produces this diagnostic when a reference to a declaration
that is annotated with the internal
annotation is found
outside the package containing the declaration.
Example
#Given a package p
that defines a library containing a declaration marked
with the internal
annotation:
dart
import 'package:meta/meta.dart';
@internal
class C {}
The following code produces this diagnostic because it's referencing the
class C
, which isn't intended to be used outside the package p
:
dart
import 'package:p/src/p.dart';
void f(C c) {}
Common fixes
#除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。