createUser static method

Future<User?> createUser(
  1. Result result
)

Implementation

static Future<User?> createUser(Result result) async {
  if (result.code == 200) {
    currentUser = User.create(result.data);
    final prefs = await SharedPreferences.getInstance();
    await prefs.setString(keyToken, currentUser!.token);
  } else if (result.code == 1636) {
    currentUser = User();
    currentUser!.mfaToken = result.data["mfaToken"];
  } else if (result.code == 1639) {
    currentUser = User();
    currentUser!.firstTimeLoginToken = result.data["token"];
  }
  return currentUser;
}