copyWith method
- int? id,
- String? institutionId,
- String? role,
- int? roleId,
- String? phoneNumber,
- String? fcmToken,
- DateTime? fcmTokenUpdatedAt,
- String? currentBlockName,
- int? currentBlockId,
- int? currentWardID,
- String? currentWardName,
- int? floor,
- int? hospitalId,
- bool? isApprover,
- bool? isSuperuser,
- bool? isResponder,
- bool? isCreator,
Creates a copy of this User object with the given fields replaced with new values.
This method is useful for creating a new User instance based on an existing one but with some properties modified, without directly mutating the original object.
Implementation
User copyWith({
int? id,
String? institutionId,
String? role,
int? roleId,
String? phoneNumber,
String? fcmToken,
DateTime? fcmTokenUpdatedAt,
String? currentBlockName,
int? currentBlockId,
int? currentWardID,
String? currentWardName,
int? floor,
int? hospitalId,
bool? isApprover,
bool? isSuperuser,
bool? isResponder,
bool? isCreator,
}) {
return User(
id: id ?? this.id,
institutionId: institutionId ?? this.institutionId,
role: role ?? this.role,
roleId: roleId ?? this.roleId,
phoneNumber: phoneNumber ?? this.phoneNumber,
fcmToken: fcmToken ?? this.fcmToken,
fcmTokenUpdatedAt: fcmTokenUpdatedAt ?? this.fcmTokenUpdatedAt,
currentBlockName: currentBlockName ?? this.currentBlockName,
currentBlockId: currentBlockId ?? this.currentBlockId,
currentWardID: currentWardID ?? this.currentWardID,
currentWardName: currentWardName ?? this.currentWardName,
floor: floor ?? this.floor,
hospitalId: hospitalId ?? this.hospitalId,
isApprover: isApprover ?? this.isApprover,
isSuperuser: isSuperuser ?? this.isSuperuser,
isResponder: isResponder ?? this.isResponder,
isCreator: isCreator ?? this.isCreator,
);
}