copyWith method

  1. @override
OwnUser copyWith(
  1. {String? id,
  2. String? role,
  3. String? name,
  4. String? image,
  5. DateTime? createdAt,
  6. DateTime? updatedAt,
  7. DateTime? lastActive,
  8. bool? online,
  9. Map<String, Object?>? extraData,
  10. bool? banned,
  11. DateTime? banExpires,
  12. List<String>? teams,
  13. List<ChannelMute>? channelMutes,
  14. List<Device>? devices,
  15. List<Mute>? mutes,
  16. int? totalUnreadCount,
  17. int? unreadChannels,
  18. 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,
      // if null, it will be retrieved from extraData['name']
      name: name,
      // if null, it will be retrieved from extraData['image']
      image: 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,
    );