ignore invalid account data
This commit is contained in:
parent
3754bc2feb
commit
401b527714
1 changed files with 13 additions and 22 deletions
|
|
@ -18,15 +18,9 @@ class const AccountData({
|
|||
final RecentEmojiData recentEmoji = const RecentEmojiData(),
|
||||
|
||||
/// Room image packs the user has enabled everywhere
|
||||
@JsonKey(
|
||||
name: AccountData.imagePackRoomsKey,
|
||||
fromJson: ImagePackRooms.tryFromJson,
|
||||
)
|
||||
@JsonKey(name: AccountData.imagePackRoomsKey)
|
||||
final ImagePackRooms? imagePackRooms,
|
||||
@JsonKey(
|
||||
name: AccountData.legacyImagePackRoomsKey,
|
||||
fromJson: ImagePackRooms.tryFromJson,
|
||||
)
|
||||
@JsonKey(name: AccountData.legacyImagePackRoomsKey)
|
||||
final ImagePackRooms? legacyImagePackRooms,
|
||||
}) with _$AccountData {
|
||||
static const invitePermissionConfigKey = "m.invite_permission_config";
|
||||
|
|
@ -59,15 +53,6 @@ class const ImagePackRooms({
|
|||
/// empty) object
|
||||
final IMap<String, IMap<String, Map<String, dynamic>>> rooms = const .empty(),
|
||||
}) with _$ImagePackRooms {
|
||||
static ImagePackRooms? tryFromJson(Map<String, dynamic>? json) {
|
||||
if (json == null) return null;
|
||||
try {
|
||||
return .fromJson(json);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object?> toJson() => _$ImagePackRoomsToJson(this);
|
||||
|
||||
factory ImagePackRooms.fromJson(Map<String, Object?> json) =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue