setUser static method

Future<bool> setUser({
  1. UserModel? userModel,
})

to set user model

Implementation

static Future<bool> setUser({UserModel? userModel}) async {
  if (userModel != null) {
    String user = json.encode(userModel);
    return await _prefsInstance?.setString("user", user) ?? true;
  } else {
    return await _prefsInstance?.remove("user") ?? true;
  }
}