getInstance static method

Future<CoreStoreSharedPreferences> getInstance({
  1. SharedPreferences? store,
})

Returns a new instance of CoreStoreSharedPrefsImp.

If no instance exists, this function creates a new instance of SharedPreferences and passes it as a parameter to the constructor of CoreStoreSharedPrefsImp.

Implementation

static Future<CoreStoreSharedPreferences> getInstance(
    {SharedPreferences? store}) async {
  if (_instance == null) {
    store ??= await SharedPreferences.getInstance();
    _instance = CoreStoreSharedPreferences._internal(store);
  }

  return _instance!;
}