getInstance static method

Future<SpUtils?> getInstance()

Implementation

static Future<SpUtils?> getInstance() async {
  if (_singleton == null) {
    await lock.synchronized(() async {
      if (_singleton == null) {
        // keep local instance till it is fully initialized.
        // 保持本地实例直到完全初始化。
        var singleton = SpUtils._();
        await singleton._init();
        _singleton = singleton;
      }
    });
  }
  return _singleton;
}