copyWith method
ChannelModel
copyWith({
- String? id,
- String? type,
- String? cid,
- List<
String> ? ownCapabilities, - ChannelConfig? config,
- User? createdBy,
- bool? frozen,
- DateTime? lastMessageAt,
- DateTime? createdAt,
- DateTime? updatedAt,
- DateTime? deletedAt,
- int? memberCount,
- Map<
String, Object?> ? extraData, - String? team,
- int? cooldown,
- bool? disabled,
- DateTime? truncatedAt,
Creates a copy of ChannelModel with specified attributes overridden.
Implementation
ChannelModel copyWith({
String? id,
String? type,
String? cid,
List<String>? ownCapabilities,
ChannelConfig? config,
User? createdBy,
bool? frozen,
DateTime? lastMessageAt,
DateTime? createdAt,
DateTime? updatedAt,
DateTime? deletedAt,
int? memberCount,
Map<String, Object?>? extraData,
String? team,
int? cooldown,
bool? disabled,
bool? hidden,
DateTime? truncatedAt,
}) =>
ChannelModel(
id: id ?? this.id,
type: type ?? this.type,
cid: cid ?? this.cid,
ownCapabilities: ownCapabilities ?? this.ownCapabilities,
config: config ?? this.config,
createdBy: createdBy ?? this.createdBy,
frozen: frozen ?? this.frozen,
lastMessageAt: lastMessageAt ?? this.lastMessageAt,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
deletedAt: deletedAt ?? this.deletedAt,
memberCount: memberCount ?? this.memberCount,
extraData: extraData ?? this.extraData,
team: team ?? this.team,
cooldown: cooldown ?? this.cooldown,
disabled: disabled ?? extraData?['disabled'] as bool? ?? this.disabled,
hidden: hidden ?? extraData?['hidden'] as bool? ?? this.hidden,
truncatedAt: truncatedAt ??
(extraData?['truncated_at'] == null
? null
// ignore: cast_nullable_to_non_nullable
: DateTime.parse(extraData?['truncated_at'] as String)) ??
this.truncatedAt,
);