Only public elements in a package's private API can be annotated as being internalDRT-W1424
The analyzer produces this diagnostic when a declaration is annotated with
the internal
annotation and that declaration is either
in a public library or has a private name.
Example
The following code, when in a public library, produces this diagnostic
because the internal
annotation can't be applied to
declarations in a public library:
import 'package:meta/meta.dart';
@internal
class C {}
The following code, whether in a public or internal library, produces this
diagnostic because the internal
annotation can't be
applied to declarations with private names:
import 'package:meta/meta.dart';
@internal
class _C {}
void f(_C c) {}
Common fixes
If the declaration has a private name, then remove the annotation:
class _C {}
void f(_C c) {}
If the declaration has a public name and is intended to be internal to the
package, then move the annotated declaration into an internal library (in
other words, a library inside the src
directory).
Otherwise, remove the use of the annotation:
class C {}