如何防止私有静态方法被外部访问?

In lib/class.dart

class Class {
  static void method() {
    // some work
    _internalWork();
    // some other work
  }

  // should only be used in this class
  static void _internalWork() {}
}    

In lib/main.dart

void main() {
  Class.method(); // allow this (being public)
  Class._internalWork(); // prevent this (being private)
}

As you can see I am able to use Class._internalWork() but I want to prevent this from happening, is there any lint or annotation available that prevent private static field from being accessed?

评论