copyWith method
Creates a copy of User with specified attributes overridden.
Implementation
User copyWith({
String? id,
String? role,
String? name,
String? image,
DateTime? createdAt,
DateTime? updatedAt,
DateTime? lastActive,
bool? online,
Map<String, Object?>? extraData,
bool? banned,
DateTime? banExpires,
List<String>? teams,
String? language,
}) =>
User(
id: id ?? this.id,
role: role ?? this.role,
// if null, it will be retrieved from extraData['name']
name: name,
// if null, it will be retrieved from extraData['image']
image: image,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
lastActive: lastActive ?? this.lastActive,
online: online ?? this.online,
extraData: extraData ?? this.extraData,
banned: banned ?? this.banned,
banExpires: banExpires ?? this.banExpires,
teams: teams ?? this.teams,
language: language ?? this.language,
);