added null safety for llc
This commit is contained in:
@@ -12,19 +12,19 @@ class Action {
|
||||
factory Action.fromJson(Map<String, dynamic> json) => _$ActionFromJson(json);
|
||||
|
||||
/// The name of the action
|
||||
final String name;
|
||||
final String? name;
|
||||
|
||||
/// The style of the action
|
||||
final String style;
|
||||
final String? style;
|
||||
|
||||
/// The test of the action
|
||||
final String text;
|
||||
final String? text;
|
||||
|
||||
/// The type of the action
|
||||
final String type;
|
||||
final String? type;
|
||||
|
||||
/// The value of the action
|
||||
final String value;
|
||||
final String? value;
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => _$ActionToJson(this);
|
||||
|
||||
@@ -13,10 +13,10 @@ part 'attachment.g.dart';
|
||||
class Attachment {
|
||||
/// Constructor used for json serialization
|
||||
Attachment({
|
||||
String id,
|
||||
String? id,
|
||||
this.type,
|
||||
this.titleLink,
|
||||
String title,
|
||||
String? title,
|
||||
this.thumbUrl,
|
||||
this.text,
|
||||
this.pretext,
|
||||
@@ -34,10 +34,10 @@ class Attachment {
|
||||
this.actions,
|
||||
this.extraData,
|
||||
this.file,
|
||||
UploadState uploadState,
|
||||
UploadState? uploadState,
|
||||
}) : id = id ?? const Uuid().v4(),
|
||||
title = title ?? file?.name,
|
||||
localUri = file?.path != null ? Uri.parse(file.path) : null {
|
||||
localUri = file?.path != null ? Uri.parse(file!.path!) : null {
|
||||
this.uploadState = uploadState ??
|
||||
((assetUrl != null || imageUrl != null)
|
||||
? const UploadState.success()
|
||||
@@ -47,68 +47,68 @@ class Attachment {
|
||||
/// Create a new instance from a json
|
||||
factory Attachment.fromJson(Map<String, dynamic> json) =>
|
||||
_$AttachmentFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields));
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields)!);
|
||||
|
||||
/// Create a new instance from a db data
|
||||
factory Attachment.fromData(Map<String, dynamic> json) =>
|
||||
_$AttachmentFromJson(Serialization.moveToExtraDataFromRoot(
|
||||
json, topLevelFields + dbSpecificTopLevelFields));
|
||||
json, topLevelFields + dbSpecificTopLevelFields)!);
|
||||
|
||||
///The attachment type based on the URL resource. This can be: audio,
|
||||
///image or video
|
||||
final String type;
|
||||
final String? type;
|
||||
|
||||
///The link to which the attachment message points to.
|
||||
final String titleLink;
|
||||
final String? titleLink;
|
||||
|
||||
/// The attachment title
|
||||
final String title;
|
||||
final String? title;
|
||||
|
||||
/// The URL to the attached file thumbnail. You can use this to represent the
|
||||
/// attached link.
|
||||
final String thumbUrl;
|
||||
final String? thumbUrl;
|
||||
|
||||
/// The attachment text. It will be displayed in the channel next to the
|
||||
/// original message.
|
||||
final String text;
|
||||
final String? text;
|
||||
|
||||
/// Optional text that appears above the attachment block
|
||||
final String pretext;
|
||||
final String? pretext;
|
||||
|
||||
/// The original URL that was used to scrape this attachment.
|
||||
final String ogScrapeUrl;
|
||||
final String? ogScrapeUrl;
|
||||
|
||||
/// The URL to the attached image. This is present for URL pointing to an
|
||||
/// image article (eg. Unsplash)
|
||||
final String imageUrl;
|
||||
final String footerIcon;
|
||||
final String footer;
|
||||
final String? imageUrl;
|
||||
final String? footerIcon;
|
||||
final String? footer;
|
||||
final dynamic fields;
|
||||
final String fallback;
|
||||
final String color;
|
||||
final String? fallback;
|
||||
final String? color;
|
||||
|
||||
/// The name of the author.
|
||||
final String authorName;
|
||||
final String authorLink;
|
||||
final String authorIcon;
|
||||
final String? authorName;
|
||||
final String? authorLink;
|
||||
final String? authorIcon;
|
||||
|
||||
/// The URL to the audio, video or image related to the URL.
|
||||
final String assetUrl;
|
||||
final String? assetUrl;
|
||||
|
||||
/// Actions from a command
|
||||
final List<Action> actions;
|
||||
final List<Action>? actions;
|
||||
|
||||
final Uri localUri;
|
||||
final Uri? localUri;
|
||||
|
||||
/// The file present inside this attachment.
|
||||
final AttachmentFile file;
|
||||
final AttachmentFile? file;
|
||||
|
||||
/// The current upload state of the attachment
|
||||
UploadState uploadState;
|
||||
UploadState? uploadState;
|
||||
|
||||
/// Map of custom channel extraData
|
||||
@JsonKey(includeIfNull: false)
|
||||
final Map<String, dynamic> extraData;
|
||||
final Map<String, dynamic>? extraData;
|
||||
|
||||
/// The attachment ID.
|
||||
///
|
||||
@@ -156,28 +156,28 @@ class Attachment {
|
||||
_$AttachmentToJson(this), topLevelFields + dbSpecificTopLevelFields);
|
||||
|
||||
Attachment copyWith({
|
||||
String id,
|
||||
String type,
|
||||
String titleLink,
|
||||
String title,
|
||||
String thumbUrl,
|
||||
String text,
|
||||
String pretext,
|
||||
String ogScrapeUrl,
|
||||
String imageUrl,
|
||||
String footerIcon,
|
||||
String footer,
|
||||
String? id,
|
||||
String? type,
|
||||
String? titleLink,
|
||||
String? title,
|
||||
String? thumbUrl,
|
||||
String? text,
|
||||
String? pretext,
|
||||
String? ogScrapeUrl,
|
||||
String? imageUrl,
|
||||
String? footerIcon,
|
||||
String? footer,
|
||||
dynamic fields,
|
||||
String fallback,
|
||||
String color,
|
||||
String authorName,
|
||||
String authorLink,
|
||||
String authorIcon,
|
||||
String assetUrl,
|
||||
List<Action> actions,
|
||||
AttachmentFile file,
|
||||
UploadState uploadState,
|
||||
Map<String, dynamic> extraData,
|
||||
String? fallback,
|
||||
String? color,
|
||||
String? authorName,
|
||||
String? authorLink,
|
||||
String? authorIcon,
|
||||
String? assetUrl,
|
||||
List<Action>? actions,
|
||||
AttachmentFile? file,
|
||||
UploadState? uploadState,
|
||||
Map<String, dynamic>? extraData,
|
||||
}) =>
|
||||
Attachment(
|
||||
id: id ?? this.id,
|
||||
|
||||
@@ -19,7 +19,7 @@ abstract class UploadState with _$UploadState {
|
||||
const factory UploadState.success() = Success;
|
||||
|
||||
/// Failed state of the union
|
||||
const factory UploadState.failed({@required String error}) = Failed;
|
||||
const factory UploadState.failed({required String error}) = Failed;
|
||||
|
||||
/// Creates a new instance from a json
|
||||
factory UploadState.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -27,7 +27,7 @@ abstract class UploadState with _$UploadState {
|
||||
}
|
||||
|
||||
/// Helper extension for UploadState
|
||||
extension UploadStateX on UploadState {
|
||||
extension UploadStateX on UploadState? {
|
||||
/// Returns true if state is [Preparing]
|
||||
bool get isPreparing => this is Preparing;
|
||||
|
||||
@@ -65,21 +65,21 @@ class AttachmentFile {
|
||||
/// ```
|
||||
/// final File myFile = File(platformFile.path);
|
||||
/// ```
|
||||
final String path;
|
||||
final String? path;
|
||||
|
||||
/// File name including its extension.
|
||||
final String name;
|
||||
final String? name;
|
||||
|
||||
/// Byte data for this file. Particularly useful if you want to manipulate
|
||||
/// its data or easily upload to somewhere else.
|
||||
@JsonKey(toJson: _toString, fromJson: _fromString)
|
||||
final Uint8List bytes;
|
||||
final Uint8List? bytes;
|
||||
|
||||
/// The file size in bytes.
|
||||
final int size;
|
||||
final int? size;
|
||||
|
||||
/// File extension for this file.
|
||||
String get extension => name?.split('.')?.last;
|
||||
String? get extension => name?.split('.')?.last;
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => _$AttachmentFileToJson(this);
|
||||
|
||||
@@ -30,52 +30,52 @@ class ChannelConfig {
|
||||
_$ChannelConfigFromJson(json);
|
||||
|
||||
/// Moderation configuration
|
||||
final String automod;
|
||||
final String? automod;
|
||||
|
||||
/// List of available commands
|
||||
final List<Command> commands;
|
||||
final List<Command>? commands;
|
||||
|
||||
/// True if the channel should send connect events
|
||||
final bool connectEvents;
|
||||
final bool? connectEvents;
|
||||
|
||||
/// Date of channel creation
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
|
||||
/// Date of last channel update
|
||||
final DateTime updatedAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
/// Max channel message length
|
||||
final int maxMessageLength;
|
||||
final int? maxMessageLength;
|
||||
|
||||
/// Duration of message retention
|
||||
final String messageRetention;
|
||||
final String? messageRetention;
|
||||
|
||||
/// True if users can be muted
|
||||
final bool mutes;
|
||||
final bool? mutes;
|
||||
|
||||
/// Name of the channel
|
||||
final String name;
|
||||
final String? name;
|
||||
|
||||
/// True if reaction are active for this channel
|
||||
final bool reactions;
|
||||
final bool? reactions;
|
||||
|
||||
/// True if readEvents are active for this channel
|
||||
final bool readEvents;
|
||||
final bool? readEvents;
|
||||
|
||||
/// True if reply message are active for this channel
|
||||
final bool replies;
|
||||
final bool? replies;
|
||||
|
||||
/// True if it's possible to perform a search in this channel
|
||||
final bool search;
|
||||
final bool? search;
|
||||
|
||||
/// True if typing events should be sent for this channel
|
||||
final bool typingEvents;
|
||||
final bool? typingEvents;
|
||||
|
||||
/// True if it's possible to upload files to this channel
|
||||
final bool uploads;
|
||||
final bool? uploads;
|
||||
|
||||
/// True if urls appears as attachments
|
||||
final bool urlEnrichment;
|
||||
final bool? urlEnrichment;
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => _$ChannelConfigToJson(this);
|
||||
|
||||
@@ -26,59 +26,59 @@ class ChannelModel {
|
||||
});
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory ChannelModel.fromJson(Map<String, dynamic> json) =>
|
||||
factory ChannelModel.fromJson(Map<String, dynamic>? json) =>
|
||||
_$ChannelModelFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields));
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields)!);
|
||||
|
||||
/// The id of this channel
|
||||
final String id;
|
||||
final String? id;
|
||||
|
||||
/// The type of this channel
|
||||
final String type;
|
||||
final String? type;
|
||||
|
||||
/// The cid of this channel
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final String cid;
|
||||
final String? cid;
|
||||
|
||||
/// The channel configuration data
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final ChannelConfig config;
|
||||
final ChannelConfig? config;
|
||||
|
||||
/// The user that created this channel
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final User createdBy;
|
||||
final User? createdBy;
|
||||
|
||||
/// True if this channel is frozen
|
||||
@JsonKey(includeIfNull: false)
|
||||
final bool frozen;
|
||||
final bool? frozen;
|
||||
|
||||
/// The date of the last message
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime lastMessageAt;
|
||||
final DateTime? lastMessageAt;
|
||||
|
||||
/// The date of channel creation
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
|
||||
/// The date of the last channel update
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime updatedAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
/// The date of channel deletion
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime deletedAt;
|
||||
final DateTime? deletedAt;
|
||||
|
||||
/// The count of this channel members
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final int memberCount;
|
||||
final int? memberCount;
|
||||
|
||||
/// Map of custom channel extraData
|
||||
@JsonKey(includeIfNull: false)
|
||||
final Map<String, dynamic> extraData;
|
||||
final Map<String, dynamic>? extraData;
|
||||
|
||||
/// The team the channel belongs to
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final String team;
|
||||
final String? team;
|
||||
|
||||
/// Known top level fields.
|
||||
/// Useful for [Serialization] methods.
|
||||
@@ -98,8 +98,8 @@ class ChannelModel {
|
||||
];
|
||||
|
||||
/// Shortcut for channel name
|
||||
String get name =>
|
||||
extraData?.containsKey('name') == true ? extraData['name'] : cid;
|
||||
String? get name =>
|
||||
extraData?.containsKey('name') == true ? extraData!['name'] : cid;
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => Serialization.moveFromExtraDataToRoot(
|
||||
@@ -109,19 +109,19 @@ class ChannelModel {
|
||||
|
||||
/// Creates a copy of [ChannelModel] with specified attributes overridden.
|
||||
ChannelModel copyWith({
|
||||
String id,
|
||||
String type,
|
||||
String cid,
|
||||
ChannelConfig config,
|
||||
User createdBy,
|
||||
bool frozen,
|
||||
DateTime lastMessageAt,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
DateTime deletedAt,
|
||||
int memberCount,
|
||||
Map<String, dynamic> extraData,
|
||||
String team,
|
||||
String? id,
|
||||
String? type,
|
||||
String? cid,
|
||||
ChannelConfig? config,
|
||||
User? createdBy,
|
||||
bool? frozen,
|
||||
DateTime? lastMessageAt,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
DateTime? deletedAt,
|
||||
int? memberCount,
|
||||
Map<String, dynamic>? extraData,
|
||||
String? team,
|
||||
}) =>
|
||||
ChannelModel(
|
||||
id: id ?? this.id,
|
||||
@@ -141,7 +141,7 @@ class ChannelModel {
|
||||
|
||||
/// Returns a new [ChannelModel] that is a combination of this channelModel
|
||||
/// and the given [other] channelModel.
|
||||
ChannelModel merge(ChannelModel other) {
|
||||
ChannelModel merge(ChannelModel? other) {
|
||||
if (other == null) return this;
|
||||
return copyWith(
|
||||
id: other.id,
|
||||
|
||||
@@ -22,42 +22,42 @@ class ChannelState {
|
||||
});
|
||||
|
||||
/// The channel to which this state belongs
|
||||
final ChannelModel channel;
|
||||
final ChannelModel? channel;
|
||||
|
||||
/// A paginated list of channel messages
|
||||
final List<Message> messages;
|
||||
final List<Message>? messages;
|
||||
|
||||
/// A paginated list of channel members
|
||||
final List<Member> members;
|
||||
final List<Member?>? members;
|
||||
|
||||
/// A paginated list of pinned messages
|
||||
final List<Message> pinnedMessages;
|
||||
final List<Message>? pinnedMessages;
|
||||
|
||||
/// The count of users watching the channel
|
||||
final int watcherCount;
|
||||
final int? watcherCount;
|
||||
|
||||
/// A paginated list of users watching the channel
|
||||
final List<User> watchers;
|
||||
final List<User>? watchers;
|
||||
|
||||
/// The list of channel reads
|
||||
final List<Read> read;
|
||||
final List<Read>? read;
|
||||
|
||||
/// Create a new instance from a json
|
||||
static ChannelState fromJson(Map<String, dynamic> json) =>
|
||||
_$ChannelStateFromJson(json);
|
||||
static ChannelState fromJson(Map<String, dynamic>? json) =>
|
||||
_$ChannelStateFromJson(json!);
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => _$ChannelStateToJson(this);
|
||||
|
||||
/// Creates a copy of [ChannelState] with specified attributes overridden.
|
||||
ChannelState copyWith({
|
||||
ChannelModel channel,
|
||||
List<Message> messages,
|
||||
List<Member> members,
|
||||
List<Message> pinnedMessages,
|
||||
int watcherCount,
|
||||
List<User> watchers,
|
||||
List<Read> read,
|
||||
ChannelModel? channel,
|
||||
List<Message>? messages,
|
||||
List<Member?>? members,
|
||||
List<Message>? pinnedMessages,
|
||||
int? watcherCount,
|
||||
List<User>? watchers,
|
||||
List<Read>? read,
|
||||
}) =>
|
||||
ChannelState(
|
||||
channel: channel ?? this.channel,
|
||||
|
||||
@@ -17,13 +17,13 @@ class Command {
|
||||
_$CommandFromJson(json);
|
||||
|
||||
/// The name of the command
|
||||
final String name;
|
||||
final String? name;
|
||||
|
||||
/// The description explaining the command
|
||||
final String description;
|
||||
final String? description;
|
||||
|
||||
/// The arguments of the command
|
||||
final String args;
|
||||
final String? args;
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => _$CommandToJson(this);
|
||||
|
||||
@@ -15,10 +15,10 @@ class Device {
|
||||
factory Device.fromJson(Map<String, dynamic> json) => _$DeviceFromJson(json);
|
||||
|
||||
/// The id of the device
|
||||
final String id;
|
||||
final String? id;
|
||||
|
||||
/// The notification push provider
|
||||
final String pushProvider;
|
||||
final String? pushProvider;
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => _$DeviceToJson(this);
|
||||
|
||||
@@ -31,68 +31,68 @@ class Event {
|
||||
}) : isLocal = true;
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory Event.fromJson(Map<String, dynamic> json) =>
|
||||
factory Event.fromJson(Map<String, dynamic>? json) =>
|
||||
_$EventFromJson(Serialization.moveToExtraDataFromRoot(
|
||||
json,
|
||||
topLevelFields,
|
||||
))
|
||||
)!)
|
||||
..isLocal = false;
|
||||
|
||||
/// The type of the event
|
||||
/// [EventType] contains some predefined constant types
|
||||
final String type;
|
||||
final String? type;
|
||||
|
||||
/// The channel cid to which the event belongs
|
||||
final String cid;
|
||||
final String? cid;
|
||||
|
||||
/// The channel id to which the event belongs
|
||||
final String channelId;
|
||||
final String? channelId;
|
||||
|
||||
/// The channel type to which the event belongs
|
||||
final String channelType;
|
||||
final String? channelType;
|
||||
|
||||
/// The connection id in which the event has been sent
|
||||
final String connectionId;
|
||||
final String? connectionId;
|
||||
|
||||
/// The date of creation of the event
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
|
||||
/// User object of the health check user
|
||||
final OwnUser me;
|
||||
final OwnUser? me;
|
||||
|
||||
/// User object of the current user
|
||||
final User user;
|
||||
final User? user;
|
||||
|
||||
/// The message sent with the event
|
||||
final Message message;
|
||||
final Message? message;
|
||||
|
||||
/// The channel sent with the event
|
||||
final EventChannel channel;
|
||||
final EventChannel? channel;
|
||||
|
||||
/// The member sent with the event
|
||||
final Member member;
|
||||
final Member? member;
|
||||
|
||||
/// The reaction sent with the event
|
||||
final Reaction reaction;
|
||||
final Reaction? reaction;
|
||||
|
||||
/// The number of unread messages for current user
|
||||
final int totalUnreadCount;
|
||||
final int? totalUnreadCount;
|
||||
|
||||
/// User total unread channels
|
||||
final int unreadChannels;
|
||||
final int? unreadChannels;
|
||||
|
||||
/// Online status
|
||||
final bool online;
|
||||
final bool? online;
|
||||
|
||||
/// The id of the parent message of a thread
|
||||
final String parentId;
|
||||
final String? parentId;
|
||||
|
||||
/// True if the event is generated by this client
|
||||
bool isLocal;
|
||||
bool? isLocal;
|
||||
|
||||
/// Map of custom channel extraData
|
||||
@JsonKey(includeIfNull: false)
|
||||
final Map<String, dynamic> extraData;
|
||||
final Map<String, dynamic>? extraData;
|
||||
|
||||
/// Known top level fields.
|
||||
/// Useful for [Serialization] methods.
|
||||
@@ -124,23 +124,23 @@ class Event {
|
||||
|
||||
/// Creates a copy of [Event] with specified attributes overridden.
|
||||
Event copyWith({
|
||||
String type,
|
||||
String cid,
|
||||
String channelId,
|
||||
String channelType,
|
||||
String connectionId,
|
||||
DateTime createdAt,
|
||||
OwnUser me,
|
||||
User user,
|
||||
Message message,
|
||||
EventChannel channel,
|
||||
Member member,
|
||||
Reaction reaction,
|
||||
int totalUnreadCount,
|
||||
int unreadChannels,
|
||||
bool online,
|
||||
String parentId,
|
||||
Map<String, dynamic> extraData,
|
||||
String? type,
|
||||
String? cid,
|
||||
String? channelId,
|
||||
String? channelType,
|
||||
String? connectionId,
|
||||
DateTime? createdAt,
|
||||
OwnUser? me,
|
||||
User? user,
|
||||
Message? message,
|
||||
EventChannel? channel,
|
||||
Member? member,
|
||||
Reaction? reaction,
|
||||
int? totalUnreadCount,
|
||||
int? unreadChannels,
|
||||
bool? online,
|
||||
String? parentId,
|
||||
Map<String, dynamic>? extraData,
|
||||
}) =>
|
||||
Event(
|
||||
type: type ?? this.type,
|
||||
@@ -169,18 +169,18 @@ class EventChannel extends ChannelModel {
|
||||
/// Constructor used for json serialization
|
||||
EventChannel({
|
||||
this.members,
|
||||
String id,
|
||||
String type,
|
||||
String cid,
|
||||
ChannelConfig config,
|
||||
User createdBy,
|
||||
bool frozen,
|
||||
DateTime lastMessageAt,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
DateTime deletedAt,
|
||||
int memberCount,
|
||||
Map<String, dynamic> extraData,
|
||||
String? id,
|
||||
String? type,
|
||||
String? cid,
|
||||
ChannelConfig? config,
|
||||
User? createdBy,
|
||||
bool? frozen,
|
||||
DateTime? lastMessageAt,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
DateTime? deletedAt,
|
||||
int? memberCount,
|
||||
Map<String, dynamic>? extraData,
|
||||
}) : super(
|
||||
id: id,
|
||||
type: type,
|
||||
@@ -197,14 +197,14 @@ class EventChannel extends ChannelModel {
|
||||
);
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory EventChannel.fromJson(Map<String, dynamic> json) =>
|
||||
factory EventChannel.fromJson(Map<String, dynamic>? json) =>
|
||||
_$EventChannelFromJson(Serialization.moveToExtraDataFromRoot(
|
||||
json,
|
||||
topLevelFields,
|
||||
));
|
||||
)!);
|
||||
|
||||
/// A paginated list of channel members
|
||||
final List<Member> members;
|
||||
final List<Member>? members;
|
||||
|
||||
/// Known top level fields.
|
||||
/// Useful for [Serialization] methods.
|
||||
|
||||
@@ -31,51 +31,51 @@ class Member {
|
||||
}
|
||||
|
||||
/// The interested user
|
||||
final User user;
|
||||
final User? user;
|
||||
|
||||
/// The date in which the user accepted the invite to the channel
|
||||
final DateTime inviteAcceptedAt;
|
||||
final DateTime? inviteAcceptedAt;
|
||||
|
||||
/// The date in which the user rejected the invite to the channel
|
||||
final DateTime inviteRejectedAt;
|
||||
final DateTime? inviteRejectedAt;
|
||||
|
||||
/// True if the user has been invited to the channel
|
||||
final bool invited;
|
||||
final bool? invited;
|
||||
|
||||
/// The role of the user in the channel
|
||||
final String role;
|
||||
final String? role;
|
||||
|
||||
/// The id of the interested user
|
||||
final String userId;
|
||||
final String? userId;
|
||||
|
||||
/// True if the user is a moderator of the channel
|
||||
final bool isModerator;
|
||||
final bool? isModerator;
|
||||
|
||||
/// True if the member is banned from the channel
|
||||
final bool banned;
|
||||
final bool? banned;
|
||||
|
||||
/// True if the member is shadow banned from the channel
|
||||
final bool shadowBanned;
|
||||
final bool? shadowBanned;
|
||||
|
||||
/// The date of creation
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
|
||||
/// The last date of update
|
||||
final DateTime updatedAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
/// Creates a copy of [Member] with specified attributes overridden.
|
||||
Member copyWith({
|
||||
User user,
|
||||
DateTime inviteAcceptedAt,
|
||||
DateTime inviteRejectedAt,
|
||||
bool invited,
|
||||
String role,
|
||||
String userId,
|
||||
bool isModerator,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
bool banned,
|
||||
bool shadowBanned,
|
||||
User? user,
|
||||
DateTime? inviteAcceptedAt,
|
||||
DateTime? inviteRejectedAt,
|
||||
bool? invited,
|
||||
String? role,
|
||||
String? userId,
|
||||
bool? isModerator,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
bool? banned,
|
||||
bool? shadowBanned,
|
||||
}) =>
|
||||
Member(
|
||||
user: user ?? this.user,
|
||||
|
||||
@@ -44,7 +44,7 @@ enum MessageSendingStatus {
|
||||
class Message {
|
||||
/// Constructor used for json serialization
|
||||
Message({
|
||||
String id,
|
||||
String? id,
|
||||
this.text,
|
||||
this.type,
|
||||
this.attachments,
|
||||
@@ -67,7 +67,7 @@ class Message {
|
||||
this.user,
|
||||
this.pinned = false,
|
||||
this.pinnedAt,
|
||||
DateTime pinExpires,
|
||||
DateTime? pinExpires,
|
||||
this.pinnedBy,
|
||||
this.extraData,
|
||||
this.deletedAt,
|
||||
@@ -77,15 +77,15 @@ class Message {
|
||||
pinExpires = pinExpires?.toUtc();
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory Message.fromJson(Map<String, dynamic> json) => _$MessageFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields));
|
||||
factory Message.fromJson(Map<String, dynamic>? json) => _$MessageFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields)!);
|
||||
|
||||
/// The message ID. This is either created by Stream or set client side when
|
||||
/// the message is added.
|
||||
final String id;
|
||||
|
||||
/// The text of this message
|
||||
final String text;
|
||||
final String? text;
|
||||
|
||||
/// The status of a sending message
|
||||
@JsonKey(ignore: true)
|
||||
@@ -93,99 +93,99 @@ class Message {
|
||||
|
||||
/// The message type
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final String type;
|
||||
final String? type;
|
||||
|
||||
/// The list of attachments, either provided by the user or generated from a
|
||||
/// command or as a result of URL scraping.
|
||||
@JsonKey(includeIfNull: false)
|
||||
final List<Attachment> attachments;
|
||||
final List<Attachment>? attachments;
|
||||
|
||||
/// The list of user mentioned in the message
|
||||
@JsonKey(toJson: Serialization.userIds)
|
||||
final List<User> mentionedUsers;
|
||||
final List<User>? mentionedUsers;
|
||||
|
||||
/// A map describing the count of number of every reaction
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final Map<String, int> reactionCounts;
|
||||
final Map<String?, int>? reactionCounts;
|
||||
|
||||
/// A map describing the count of score of every reaction
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final Map<String, int> reactionScores;
|
||||
final Map<String?, int>? reactionScores;
|
||||
|
||||
/// The latest reactions to the message created by any user.
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final List<Reaction> latestReactions;
|
||||
final List<Reaction>? latestReactions;
|
||||
|
||||
/// The reactions added to the message by the current user.
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final List<Reaction> ownReactions;
|
||||
final List<Reaction>? ownReactions;
|
||||
|
||||
/// The ID of the parent message, if the message is a thread reply.
|
||||
final String parentId;
|
||||
final String? parentId;
|
||||
|
||||
/// A quoted reply message
|
||||
@JsonKey(toJson: Serialization.readOnly)
|
||||
final Message quotedMessage;
|
||||
final Message? quotedMessage;
|
||||
|
||||
/// The ID of the quoted message, if the message is a quoted reply.
|
||||
final String quotedMessageId;
|
||||
final String? quotedMessageId;
|
||||
|
||||
/// Reserved field indicating the number of replies for this message.
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final int replyCount;
|
||||
final int? replyCount;
|
||||
|
||||
/// Reserved field indicating the thread participants for this message.
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final List<User> threadParticipants;
|
||||
final List<User>? threadParticipants;
|
||||
|
||||
/// Check if this message needs to show in the channel.
|
||||
final bool showInChannel;
|
||||
final bool? showInChannel;
|
||||
|
||||
/// If true the message is silent
|
||||
final bool silent;
|
||||
final bool? silent;
|
||||
|
||||
/// If true the message will not send a push notification
|
||||
final bool skipPush;
|
||||
final bool? skipPush;
|
||||
|
||||
/// If true the message is shadowed
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final bool shadowed;
|
||||
final bool? shadowed;
|
||||
|
||||
/// A used command name.
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final String command;
|
||||
final String? command;
|
||||
|
||||
/// Reserved field indicating when the message was created.
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
|
||||
/// Reserved field indicating when the message was updated last time.
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime updatedAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
/// User who sent the message
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final User user;
|
||||
final User? user;
|
||||
|
||||
/// If true the message is pinned
|
||||
final bool pinned;
|
||||
final bool? pinned;
|
||||
|
||||
/// Reserved field indicating when the message was pinned
|
||||
@JsonKey(toJson: Serialization.readOnly)
|
||||
final DateTime pinnedAt;
|
||||
final DateTime? pinnedAt;
|
||||
|
||||
/// Reserved field indicating when the message will expire
|
||||
///
|
||||
/// if `null` message has no expiry
|
||||
final DateTime pinExpires;
|
||||
final DateTime? pinExpires;
|
||||
|
||||
/// Reserved field indicating who pinned the message
|
||||
@JsonKey(toJson: Serialization.readOnly)
|
||||
final User pinnedBy;
|
||||
final User? pinnedBy;
|
||||
|
||||
/// Message custom extraData
|
||||
@JsonKey(includeIfNull: false)
|
||||
final Map<String, dynamic> extraData;
|
||||
final Map<String, dynamic>? extraData;
|
||||
|
||||
/// True if the message is a system info
|
||||
bool get isSystem => type == 'system';
|
||||
@@ -198,7 +198,7 @@ class Message {
|
||||
|
||||
/// Reserved field indicating when the message was deleted.
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime deletedAt;
|
||||
final DateTime? deletedAt;
|
||||
|
||||
/// Known top level fields.
|
||||
/// Useful for [Serialization] methods.
|
||||
@@ -239,35 +239,35 @@ class Message {
|
||||
|
||||
/// Creates a copy of [Message] with specified attributes overridden.
|
||||
Message copyWith({
|
||||
String id,
|
||||
String text,
|
||||
String type,
|
||||
List<Attachment> attachments,
|
||||
List<User> mentionedUsers,
|
||||
Map<String, int> reactionCounts,
|
||||
Map<String, int> reactionScores,
|
||||
List<Reaction> latestReactions,
|
||||
List<Reaction> ownReactions,
|
||||
String parentId,
|
||||
Message quotedMessage,
|
||||
String quotedMessageId,
|
||||
int replyCount,
|
||||
List<User> threadParticipants,
|
||||
bool showInChannel,
|
||||
bool shadowed,
|
||||
bool silent,
|
||||
String command,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
DateTime deletedAt,
|
||||
User user,
|
||||
bool pinned,
|
||||
DateTime pinnedAt,
|
||||
Object pinExpires = _pinExpires,
|
||||
User pinnedBy,
|
||||
Map<String, dynamic> extraData,
|
||||
MessageSendingStatus status,
|
||||
bool skipPush,
|
||||
String? id,
|
||||
String? text,
|
||||
String? type,
|
||||
List<Attachment>? attachments,
|
||||
List<User>? mentionedUsers,
|
||||
Map<String?, int>? reactionCounts,
|
||||
Map<String?, int>? reactionScores,
|
||||
List<Reaction>? latestReactions,
|
||||
List<Reaction>? ownReactions,
|
||||
String? parentId,
|
||||
Message? quotedMessage,
|
||||
String? quotedMessageId,
|
||||
int? replyCount,
|
||||
List<User>? threadParticipants,
|
||||
bool? showInChannel,
|
||||
bool? shadowed,
|
||||
bool? silent,
|
||||
String? command,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
DateTime? deletedAt,
|
||||
User? user,
|
||||
bool? pinned,
|
||||
DateTime? pinnedAt,
|
||||
Object? pinExpires = _pinExpires,
|
||||
User? pinnedBy,
|
||||
Map<String, dynamic>? extraData,
|
||||
MessageSendingStatus? status,
|
||||
bool? skipPush,
|
||||
}) {
|
||||
assert(() {
|
||||
if (pinExpires is! DateTime &&
|
||||
@@ -305,7 +305,8 @@ class Message {
|
||||
pinned: pinned ?? this.pinned,
|
||||
pinnedAt: pinnedAt ?? this.pinnedAt,
|
||||
pinnedBy: pinnedBy ?? this.pinnedBy,
|
||||
pinExpires: pinExpires == _pinExpires ? this.pinExpires : pinExpires,
|
||||
pinExpires:
|
||||
pinExpires == _pinExpires ? this.pinExpires : pinExpires as DateTime?,
|
||||
skipPush: skipPush ?? this.skipPush,
|
||||
);
|
||||
}
|
||||
@@ -355,13 +356,13 @@ class TranslatedMessage extends Message {
|
||||
TranslatedMessage(this.i18n);
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory TranslatedMessage.fromJson(Map<String, dynamic> json) =>
|
||||
factory TranslatedMessage.fromJson(Map<String, dynamic>? json) =>
|
||||
_$TranslatedMessageFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields),
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields)!,
|
||||
);
|
||||
|
||||
/// A Map of
|
||||
final Map<String, String> i18n;
|
||||
final Map<String, String>? i18n;
|
||||
|
||||
/// Known top level fields.
|
||||
/// Useful for [Serialization] methods.
|
||||
|
||||
@@ -16,19 +16,19 @@ class Mute {
|
||||
|
||||
/// The user that performed the muting action
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final User user;
|
||||
final User? user;
|
||||
|
||||
/// The target user
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final ChannelModel channel;
|
||||
final ChannelModel? channel;
|
||||
|
||||
/// The date in which the use was muted
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
|
||||
/// The date of the last update
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime updatedAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => _$MuteToJson(this);
|
||||
|
||||
@@ -17,14 +17,14 @@ class OwnUser extends User {
|
||||
this.totalUnreadCount,
|
||||
this.unreadChannels,
|
||||
this.channelMutes,
|
||||
String id,
|
||||
String role,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
DateTime lastActive,
|
||||
bool online,
|
||||
Map<String, dynamic> extraData,
|
||||
bool banned,
|
||||
String? id,
|
||||
String? role,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
DateTime? lastActive,
|
||||
bool? online,
|
||||
Map<String, dynamic>? extraData,
|
||||
bool? banned,
|
||||
}) : super(
|
||||
id: id,
|
||||
role: role,
|
||||
@@ -37,28 +37,28 @@ class OwnUser extends User {
|
||||
);
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory OwnUser.fromJson(Map<String, dynamic> json) => _$OwnUserFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields));
|
||||
factory OwnUser.fromJson(Map<String, dynamic>? json) => _$OwnUserFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields)!);
|
||||
|
||||
/// List of user devices
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final List<Device> devices;
|
||||
final List<Device>? devices;
|
||||
|
||||
/// List of users muted by the user
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final List<Mute> mutes;
|
||||
final List<Mute>? mutes;
|
||||
|
||||
/// List of users muted by the user
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final List<Mute> channelMutes;
|
||||
final List<Mute>? channelMutes;
|
||||
|
||||
/// Total unread messages by the user
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final int totalUnreadCount;
|
||||
final int? totalUnreadCount;
|
||||
|
||||
/// Total unread channels by the user
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final int unreadChannels;
|
||||
final int? unreadChannels;
|
||||
|
||||
/// Known top level fields.
|
||||
/// Useful for [Serialization] methods.
|
||||
|
||||
@@ -13,39 +13,39 @@ class Reaction {
|
||||
this.createdAt,
|
||||
this.type,
|
||||
this.user,
|
||||
String userId,
|
||||
String? userId,
|
||||
this.score,
|
||||
this.extraData,
|
||||
}) : userId = userId ?? user?.id;
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory Reaction.fromJson(Map<String, dynamic> json) => _$ReactionFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields));
|
||||
factory Reaction.fromJson(Map<String, dynamic>? json) => _$ReactionFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields)!);
|
||||
|
||||
/// The messageId to which the reaction belongs
|
||||
final String messageId;
|
||||
final String? messageId;
|
||||
|
||||
/// The type of the reaction
|
||||
final String type;
|
||||
final String? type;
|
||||
|
||||
/// The date of the reaction
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
|
||||
/// The user that sent the reaction
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final User user;
|
||||
final User? user;
|
||||
|
||||
/// The score of the reaction (ie. number of reactions sent)
|
||||
final int score;
|
||||
final int? score;
|
||||
|
||||
/// The userId that sent the reaction
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final String userId;
|
||||
final String? userId;
|
||||
|
||||
/// Reaction custom extraData
|
||||
@JsonKey(includeIfNull: false)
|
||||
final Map<String, dynamic> extraData;
|
||||
final Map<String, dynamic>? extraData;
|
||||
|
||||
/// Map of custom user extraData
|
||||
static const topLevelFields = [
|
||||
@@ -63,13 +63,13 @@ class Reaction {
|
||||
|
||||
/// Creates a copy of [Reaction] with specified attributes overridden.
|
||||
Reaction copyWith({
|
||||
String messageId,
|
||||
DateTime createdAt,
|
||||
String type,
|
||||
User user,
|
||||
String userId,
|
||||
int score,
|
||||
Map<String, dynamic> extraData,
|
||||
String? messageId,
|
||||
DateTime? createdAt,
|
||||
String? type,
|
||||
User? user,
|
||||
String? userId,
|
||||
int? score,
|
||||
Map<String, dynamic>? extraData,
|
||||
}) =>
|
||||
Reaction(
|
||||
messageId: messageId ?? this.messageId,
|
||||
|
||||
@@ -17,22 +17,22 @@ class Read {
|
||||
factory Read.fromJson(Map<String, dynamic> json) => _$ReadFromJson(json);
|
||||
|
||||
/// Date of the read event
|
||||
final DateTime lastRead;
|
||||
final DateTime? lastRead;
|
||||
|
||||
/// User who sent the event
|
||||
final User user;
|
||||
final User? user;
|
||||
|
||||
/// Number of unread messages
|
||||
final int unreadMessages;
|
||||
final int? unreadMessages;
|
||||
|
||||
/// Serialize to json
|
||||
Map<String, dynamic> toJson() => _$ReadToJson(this);
|
||||
|
||||
/// Creates a copy of [Read] with specified attributes overridden.
|
||||
Read copyWith({
|
||||
DateTime lastRead,
|
||||
User user,
|
||||
int unreadMessages,
|
||||
DateTime? lastRead,
|
||||
User? user,
|
||||
int? unreadMessages,
|
||||
}) =>
|
||||
Read(
|
||||
lastRead: lastRead ?? this.lastRead,
|
||||
|
||||
@@ -10,12 +10,12 @@ class Serialization {
|
||||
static const Function readOnly = readonly;
|
||||
|
||||
/// List of users to list of userIds
|
||||
static List<String> userIds(List<User> users) =>
|
||||
static List<String?>? userIds(List<User>? users) =>
|
||||
users?.map((u) => u.id)?.toList();
|
||||
|
||||
/// Takes unknown json keys and puts them in the `extra_data` key
|
||||
static Map<String, dynamic> moveToExtraDataFromRoot(
|
||||
Map<String, dynamic> json,
|
||||
static Map<String, dynamic>? moveToExtraDataFromRoot(
|
||||
Map<String, dynamic>? json,
|
||||
List<String> topLevelFields,
|
||||
) {
|
||||
if (json == null) return null;
|
||||
|
||||
@@ -20,8 +20,8 @@ class User {
|
||||
});
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields));
|
||||
factory User.fromJson(Map<String, dynamic>? json) => _$UserFromJson(
|
||||
Serialization.moveToExtraDataFromRoot(json, topLevelFields)!);
|
||||
|
||||
/// Use this named constructor to create a new user instance
|
||||
User.init(
|
||||
@@ -49,47 +49,47 @@ class User {
|
||||
];
|
||||
|
||||
/// User id
|
||||
final String id;
|
||||
final String? id;
|
||||
|
||||
/// User role
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final String role;
|
||||
final String? role;
|
||||
|
||||
/// User role
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final List<String> teams;
|
||||
final List<String>? teams;
|
||||
|
||||
/// Date of user creation
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime createdAt;
|
||||
final DateTime? createdAt;
|
||||
|
||||
/// Date of last user update
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime updatedAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
/// Date of last user connection
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final DateTime lastActive;
|
||||
final DateTime? lastActive;
|
||||
|
||||
/// True if user is online
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final bool online;
|
||||
final bool? online;
|
||||
|
||||
/// True if user is banned from the chat
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
final bool banned;
|
||||
final bool? banned;
|
||||
|
||||
/// Map of custom user extraData
|
||||
@JsonKey(includeIfNull: false)
|
||||
final Map<String, dynamic> extraData;
|
||||
final Map<String, dynamic>? extraData;
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
|
||||
/// Shortcut for user name
|
||||
String get name =>
|
||||
(extraData?.containsKey('name') == true && extraData['name'] != '')
|
||||
? extraData['name']
|
||||
String? get name =>
|
||||
(extraData?.containsKey('name') == true && extraData!['name'] != '')
|
||||
? extraData!['name']
|
||||
: id;
|
||||
|
||||
@override
|
||||
@@ -103,15 +103,15 @@ class User {
|
||||
|
||||
/// Creates a copy of [User] with specified attributes overridden.
|
||||
User copyWith({
|
||||
String id,
|
||||
String role,
|
||||
DateTime createdAt,
|
||||
DateTime updatedAt,
|
||||
DateTime lastActive,
|
||||
bool online,
|
||||
Map<String, dynamic> extraData,
|
||||
bool banned,
|
||||
List<String> teams,
|
||||
String? id,
|
||||
String? role,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
DateTime? lastActive,
|
||||
bool? online,
|
||||
Map<String, dynamic>? extraData,
|
||||
bool? banned,
|
||||
List<String>? teams,
|
||||
}) =>
|
||||
User(
|
||||
id: id ?? this.id,
|
||||
|
||||
Reference in New Issue
Block a user