copyWith method
OwnUser
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, - List<
ChannelMute> ? channelMutes, - List<
Device> ? devices, - List<
Mute> ? mutes, - int? totalUnreadCount,
- int? unreadChannels,
- String? language,
override
Creates a copy of OwnUser with specified attributes overridden.
Implementation
@override
OwnUser 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,
List<ChannelMute>? channelMutes,
List<Device>? devices,
List<Mute>? mutes,
int? totalUnreadCount,
int? unreadChannels,
String? language,
}) =>
OwnUser(
id: id ?? this.id,
role: role ?? this.role,
name: name ??
extraData?['name'] as String? ??
// Using extraData value in order to not use id as name.
this.extraData['name'] as String?,
image: image ?? extraData?['image'] as String? ?? this.image,
banned: banned ?? this.banned,
banExpires: banExpires ?? this.banExpires,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
lastActive: lastActive ?? this.lastActive,
online: online ?? this.online,
extraData: extraData ?? this.extraData,
teams: teams ?? this.teams,
channelMutes: channelMutes ?? this.channelMutes,
devices: devices ?? this.devices,
mutes: mutes ?? this.mutes,
totalUnreadCount: totalUnreadCount ?? this.totalUnreadCount,
unreadChannels: unreadChannels ?? this.unreadChannels,
language: language ?? this.language,
);