add toJson to all content models
Fixes a regression from the primary constructor content migration
This commit is contained in:
parent
a3ef4f8135
commit
2041b81141
15 changed files with 45 additions and 0 deletions
|
|
@ -9,6 +9,9 @@ part "avatar.g.dart";
|
||||||
class const AvatarContent({final ImageInfo? info, final Uri? url})
|
class const AvatarContent({final ImageInfo? info, final Uri? url})
|
||||||
extends Content
|
extends Content
|
||||||
with _$AvatarContent {
|
with _$AvatarContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$AvatarContentToJson(this);
|
||||||
|
|
||||||
factory AvatarContent.fromJson(Map<String, Object?> json) =>
|
factory AvatarContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$AvatarContentFromJson(json);
|
_$AvatarContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ class const CanonicalAliasContent({
|
||||||
@JsonKey(includeIfNull: false) final String? alias,
|
@JsonKey(includeIfNull: false) final String? alias,
|
||||||
final ISet<String> altAliases = const .empty(),
|
final ISet<String> altAliases = const .empty(),
|
||||||
}) extends Content with _$CanonicalAliasContent {
|
}) extends Content with _$CanonicalAliasContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$CanonicalAliasContentToJson(this);
|
||||||
|
|
||||||
factory CanonicalAliasContent.fromJson(Map<String, Object?> json) =>
|
factory CanonicalAliasContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$CanonicalAliasContentFromJson(json);
|
_$CanonicalAliasContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ class const CreateContent({
|
||||||
final String roomVersion = "1",
|
final String roomVersion = "1",
|
||||||
@JsonKey(unknownEnumValue: RoomType.room) final RoomType? type,
|
@JsonKey(unknownEnumValue: RoomType.room) final RoomType? type,
|
||||||
}) extends Content with _$CreateContent {
|
}) extends Content with _$CreateContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$CreateContentToJson(this);
|
||||||
|
|
||||||
factory CreateContent.fromJson(Map<String, Object?> json) =>
|
factory CreateContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$CreateContentFromJson(json);
|
_$CreateContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ class const EncryptionContent({
|
||||||
@JsonKey(name: "rotation_period_ms") final int rotationPeriodMS = 604800000,
|
@JsonKey(name: "rotation_period_ms") final int rotationPeriodMS = 604800000,
|
||||||
@JsonKey(name: "rotation_period_msgs") final int rotationPeriodMessages = 100,
|
@JsonKey(name: "rotation_period_msgs") final int rotationPeriodMessages = 100,
|
||||||
}) extends Content with _$EncryptionContent {
|
}) extends Content with _$EncryptionContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$EncryptionContentToJson(this);
|
||||||
|
|
||||||
factory EncryptionContent.fromJson(Map<String, Object?> json) =>
|
factory EncryptionContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$EncryptionContentFromJson(json);
|
_$EncryptionContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ class const HistoryVisibilityContent({
|
||||||
@JsonKey(unknownEnumValue: HistoryVisibility.unknown)
|
@JsonKey(unknownEnumValue: HistoryVisibility.unknown)
|
||||||
required final HistoryVisibility historyVisibility,
|
required final HistoryVisibility historyVisibility,
|
||||||
}) extends Content with _$HistoryVisibilityContent {
|
}) extends Content with _$HistoryVisibilityContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$HistoryVisibilityContentToJson(this);
|
||||||
|
|
||||||
factory HistoryVisibilityContent.fromJson(Map<String, Object?> json) =>
|
factory HistoryVisibilityContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$HistoryVisibilityContentFromJson(json);
|
_$HistoryVisibilityContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ class const ImagePackContent({
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$ImagePackContentToJson(this);
|
||||||
|
|
||||||
factory ImagePackContent.fromJson(Map<String, Object?> json) =>
|
factory ImagePackContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$ImagePackContentFromJson(json);
|
_$ImagePackContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ class const JoinRulesContent({
|
||||||
@JsonKey(unknownEnumValue: JoinRule.unknown) required final JoinRule joinRule,
|
@JsonKey(unknownEnumValue: JoinRule.unknown) required final JoinRule joinRule,
|
||||||
final ISet<AllowCondition> allow = const .empty(),
|
final ISet<AllowCondition> allow = const .empty(),
|
||||||
}) extends Content with _$JoinRulesContent {
|
}) extends Content with _$JoinRulesContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$JoinRulesContentToJson(this);
|
||||||
|
|
||||||
factory JoinRulesContent.fromJson(Map<String, Object?> json) =>
|
factory JoinRulesContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$JoinRulesContentFromJson(json);
|
_$JoinRulesContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ class const MembershipContent({
|
||||||
static String? displaynameFromJson(String? displayName) =>
|
static String? displaynameFromJson(String? displayName) =>
|
||||||
displayName?.isEmpty == true ? null : displayName;
|
displayName?.isEmpty == true ? null : displayName;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$MembershipContentToJson(this);
|
||||||
|
|
||||||
factory MembershipContent.fromJson(Map<String, Object?> json) =>
|
factory MembershipContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$MembershipContentFromJson(json);
|
_$MembershipContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ part "name.g.dart";
|
||||||
class const NameContent({required final String name})
|
class const NameContent({required final String name})
|
||||||
extends Content
|
extends Content
|
||||||
with _$NameContent {
|
with _$NameContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$NameContentToJson(this);
|
||||||
|
|
||||||
factory NameContent.fromJson(Map<String, Object?> json) =>
|
factory NameContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$NameContentFromJson(json);
|
_$NameContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ part "pinned_events.g.dart";
|
||||||
class const PinnedEventsContent({
|
class const PinnedEventsContent({
|
||||||
@JsonKey(name: "pinned") final IList<String> pinnedEvents = const .empty(),
|
@JsonKey(name: "pinned") final IList<String> pinnedEvents = const .empty(),
|
||||||
}) extends Content with _$PinnedEventsContent {
|
}) extends Content with _$PinnedEventsContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$PinnedEventsContentToJson(this);
|
||||||
|
|
||||||
factory PinnedEventsContent.fromJson(Map<String, Object?> json) =>
|
factory PinnedEventsContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$PinnedEventsContentFromJson(json);
|
_$PinnedEventsContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ class const PowerLevelsContent({
|
||||||
final int stateDefault = 50,
|
final int stateDefault = 50,
|
||||||
final int usersDefault = 0,
|
final int usersDefault = 0,
|
||||||
}) extends Content with _$PowerLevelsContent {
|
}) extends Content with _$PowerLevelsContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$PowerLevelsContentToJson(this);
|
||||||
|
|
||||||
factory PowerLevelsContent.fromJson(Map<String, Object?> json) =>
|
factory PowerLevelsContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$PowerLevelsContentFromJson(json);
|
_$PowerLevelsContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ part "redaction.g.dart";
|
||||||
class const RedactionContent({final String? reason, final String? redacts})
|
class const RedactionContent({final String? reason, final String? redacts})
|
||||||
extends Content
|
extends Content
|
||||||
with _$RedactionContent {
|
with _$RedactionContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$RedactionContentToJson(this);
|
||||||
|
|
||||||
factory RedactionContent.fromJson(Map<String, Object?> json) =>
|
factory RedactionContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$RedactionContentFromJson(json);
|
_$RedactionContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ class const ServerACLContent({
|
||||||
final IList<String> deny = const .empty(),
|
final IList<String> deny = const .empty(),
|
||||||
final bool allowIpLiterals = true,
|
final bool allowIpLiterals = true,
|
||||||
}) extends Content with _$ServerACLContent {
|
}) extends Content with _$ServerACLContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$ServerACLContentToJson(this);
|
||||||
|
|
||||||
factory ServerACLContent.fromJson(Map<String, Object?> json) =>
|
factory ServerACLContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$ServerACLContentFromJson(json);
|
_$ServerACLContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ class const StickerContent({
|
||||||
required final ImageInfo info,
|
required final ImageInfo info,
|
||||||
required final Uri url,
|
required final Uri url,
|
||||||
}) extends Content with _$StickerContent {
|
}) extends Content with _$StickerContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$StickerContentToJson(this);
|
||||||
|
|
||||||
factory StickerContent.fromJson(Map<String, Object?> json) =>
|
factory StickerContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$StickerContentFromJson(json);
|
_$StickerContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ class const TopicContent({
|
||||||
required final String topic,
|
required final String topic,
|
||||||
@JsonKey(name: "m.topic") final TopicContentBlock? content,
|
@JsonKey(name: "m.topic") final TopicContentBlock? content,
|
||||||
}) extends Content with _$TopicContent {
|
}) extends Content with _$TopicContent {
|
||||||
|
@override
|
||||||
|
Map<String, Object?> toJson() => _$TopicContentToJson(this);
|
||||||
|
|
||||||
factory TopicContent.fromJson(Map<String, Object?> json) =>
|
factory TopicContent.fromJson(Map<String, Object?> json) =>
|
||||||
_$TopicContentFromJson(json);
|
_$TopicContentFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue