flutter单例

2023-05-07  本文已影响0人  neobuger
class FlutterSingleInstance {
  static final FlutterSingleInstance _flutterSingleInstance = FlutterSingleInstance._internal();

  ///工厂构造函数
  factory FlutterSingleInstance() {
    return _flutterSingleInstance;
  }

  ///构造函数私有化,防止被误创建
  FlutterSingleInstance._internal(){
    print("ZczyRouteObserver初始化 构建需要的参数");
  }

}

上一篇下一篇

猜你喜欢

热点阅读