migrate ui

This commit is contained in:
Salvatore Giordano
2021-04-30 14:58:50 +02:00
parent 2c02f0f631
commit 34888d0fff
103 changed files with 2622 additions and 2455 deletions
@@ -21,7 +21,7 @@ class ChannelModel {
DateTime? updatedAt,
this.deletedAt,
this.memberCount = 0,
this.extraData,
this.extraData = const {},
this.team,
}) : assert(
(cid != null && cid.contains(':')) || (id != null && type != null),
@@ -83,8 +83,11 @@ class ChannelModel {
final int memberCount;
/// Map of custom channel extraData
@JsonKey(includeIfNull: false)
final Map<String, Object>? extraData;
@JsonKey(
includeIfNull: false,
defaultValue: {},
)
final Map<String, Object> extraData;
/// The team the channel belongs to
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
@@ -108,9 +111,8 @@ class ChannelModel {
];
/// Shortcut for channel name
String get name => extraData?.containsKey('name') == true
? extraData!['name'] as String
: cid;
String get name =>
extraData.containsKey('name') ? extraData['name'] as String : cid;
/// Serialize to json
Map<String, dynamic> toJson() => Serialization.moveFromExtraDataToRoot(