preInit static method

Future<HiCache?> preInit()

预初始化,防止在调用 get 的时候,prefs 还尚未完成初始化

Implementation

static Future<HiCache?> preInit() async {
  if (_instance == null) {
    var prefs = await SharedPreferences.getInstance();
    _instance = HiCache._pre(prefs);
  }
  return _instance;
}