UserModel constructor

UserModel({
  1. ObjectType type = ObjectType.user,
  2. Map<String, dynamic>? userData,
  3. bool logout = false,
})

Implementation

UserModel(
    {ObjectType type = ObjectType.user, Map<String, dynamic>? userData, bool logout = false})
    : super(type: type) {
  if (logout || userData == null) {
    return;
  }
  if (userData.isEmpty) {
    return;
  }
  String userId = userData['userId'] ?? '';
  if (userId.isEmpty) {
    return;
  }
  String guestUserId = myConfig?.serverConfig.guestUserId ?? '';
  if (guestUserId.isNotEmpty && guestUserId == userData['email']) {
    _isGuestUser = true;
  } else {
    _isLoginedUser = true;
  }
  fromMap(userData);
}