init static method

Future<SharedPreferences?> init()

initializing shared preference instance on app run

Implementation

static Future<SharedPreferences?> init() async {
  if (_prefsInstance == null) {
    _prefsInstance = await SharedPreferences.getInstance();
    return _prefsInstance!;
  } else {
    return _prefsInstance!;
  }
}