forked from Nexus/nexus
migrate Content classes to primary constructors
The Riverpod bug preventing us from doing this has been fixed.
This commit is contained in:
parent
853116ab2f
commit
dd01ad9d74
1 changed files with 120 additions and 162 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue