Flutter

Dart 单例模式

2019-02-14  本文已影响4人  初见破晓
class ShardPreferencesUtil {
  ShardPreferencesUtil._();

  static ShardPreferencesUtil _instance;

  static ShardPreferencesUtil getInstance() {
    if (_instance == null) {
      _instance = ShardPreferencesUtil._();
    }
    return _instance;
  }
}

上一篇 下一篇

猜你喜欢

热点阅读