private_setter
Details about the 'private_setter' diagnostic produced by the Dart analyzer.
The setter '{0}' is private and can't be accessed outside the library that declares it.
Description
#The analyzer produces this diagnostic when a private setter is used in a library where it isn't visible.
Example
#Given a file a.dart that contains the following:
class A {
static int _f = 0;
}
The following code produces this diagnostic because it references the
private setter _f even though the setter isn't visible:
import 'a.dart';
void f() {
A._f = 0;
}
Common fixes
#If you're able to make the setter public, then do so:
class A {
static int f = 0;
}
If you aren't able to make the setter public, then find a different way to implement the code.
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.