migrate Content classes to primary constructors

The Riverpod bug preventing us from doing this has been fixed.
This commit is contained in:
Henry Hiles 2026-10-23 20:44:29 -04:00
commit dd01ad9d74
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -5,14 +5,12 @@ import "package:nexus/models/content/content.dart";
part "topic.freezed.dart";
part "topic.g.dart";
@freezed
sealed class TopicContent extends Content with _$TopicContent {
TopicContent._();
factory TopicContent({
required String topic,
@JsonKey(name: "m.topic") TopicContentBlock? content,
}) = _TopicContent;
@Freezed(toJson: false, fromJson: false)
@JsonSerializable()
class const TopicContent({
required final String topic,
@JsonKey(name: "m.topic") final TopicContentBlock? content,
}) extends Content with _$TopicContent {
factory TopicContent.fromJson(Map<String, Object?> json) =>
_$TopicContentFromJson(json);
}
@ -20,7 +18,7 @@ sealed class TopicContent extends Content with _$TopicContent {
@Freezed(toJson: false, fromJson: false)
@JsonSerializable()
class const TopicContentBlock({
final IList<TextualRepresentation> representations = const IList.empty(),
final IList<TextualRepresentation> representations = const .empty(),
}) with _$TopicContentBlock {
Map<String, Object?> toJson() => _$TopicContentBlockToJson(this);