I’m having a warning message on _WordMarker
Avoid using private types in public APIs.
class WordMarker extends SingleChildRenderObjectWidget {
final int index;
const WordMarker({required Widget child, required this.index, Key? key})
: super(child: child, key: key);
@override
RenderObject createRenderObject(BuildContext context) {
return _WordMarker()..index = index;
}
//Warning message on _WordMarker
@override
void updateRenderObject(BuildContext context, _WordMarker renderObject) {
renderObject.index = index;
}
}
class _WordMarker extends RenderProxyBox {
late int index;
}
I tried following these but I’m still unable to remove the warning message.
"Avoid using private types in public APIs" Warning in Flutter
"AVOID using library private types in public APIs" – lint warning, even in in cookbook examples?
2
Answers
I remove the "_" from _WordMarker and change it to MyWordMarker and the warning disappears.
You can add this lint rule in analysis_options.yaml File & set the value to false to avoid these warnings.