美文网首页
flutter单例

flutter单例

作者: neobuger | 来源:发表于2023-05-07 11:08 被阅读0次
    class FlutterSingleInstance {
      static final FlutterSingleInstance _flutterSingleInstance = FlutterSingleInstance._internal();
    
      ///工厂构造函数
      factory FlutterSingleInstance() {
        return _flutterSingleInstance;
      }
    
      ///构造函数私有化,防止被误创建
      FlutterSingleInstance._internal(){
        print("ZczyRouteObserver初始化 构建需要的参数");
      }
    
    }
    
    

    相关文章

      网友评论

          本文标题:flutter单例

          本文链接:https://www.haomeiwen.com/subject/tovhsdtx.html