OkHiUser.fromMap constructor

OkHiUser.fromMap({
  1. required String phone,
  2. required Map<String, dynamic> data,
})

Implementation

OkHiUser.fromMap({required this.phone, required Map<String, dynamic> data}) {
  id = data.containsKey("id") ? data["id"] : null;
  firstName = data.containsKey("firstName")
      ? data["firstName"]
      : data.containsKey("first_name")
          ? data["first_name"]
          : null;
  lastName = data.containsKey("lastName")
      ? data["lastName"]
      : data.containsKey("last_name")
          ? data["last_name"]
          : null;
  email = data.containsKey("email") ? data["email"] : null;
  appUserId = data.containsKey("app_user_id")
      ? data["app_user_id"]
      : data.containsKey("appUserId")
          ? data["appUserId"]
          : null;
  token = data.containsKey("token") ? data["token"] : null;
}