added null safety for llc

This commit is contained in:
Deven Joshi
2021-04-08 15:03:16 +05:30
parent 3a5308a9c0
commit c80fc0a6b4
41 changed files with 1222 additions and 1202 deletions
+52 -52
View File
@@ -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.