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
|
|
@ -3,21 +3,13 @@ import "package:nexus/models/content/content.dart";
|
|||
part "encryption.freezed.dart";
|
||||
part "encryption.g.dart";
|
||||
|
||||
@freezed
|
||||
sealed class EncryptionContent extends Content with _$EncryptionContent {
|
||||
EncryptionContent._();
|
||||
factory EncryptionContent({
|
||||
required String algorithm,
|
||||
|
||||
@JsonKey(name: "rotation_period_ms")
|
||||
@Default(604800000)
|
||||
int rotationPeriodMS,
|
||||
|
||||
@JsonKey(name: "rotation_period_msgs")
|
||||
@Default(100)
|
||||
int rotationPeriodMessages,
|
||||
}) = _EncryptionContent;
|
||||
|
||||
@Freezed(toJson: false, fromJson: false)
|
||||
@JsonSerializable()
|
||||
class const EncryptionContent({
|
||||
required final String algorithm,
|
||||
@JsonKey(name: "rotation_period_ms") final int rotationPeriodMS = 604800000,
|
||||
@JsonKey(name: "rotation_period_msgs") final int rotationPeriodMessages = 100,
|
||||
}) extends Content with _$EncryptionContent {
|
||||
factory EncryptionContent.fromJson(Map<String, Object?> json) =>
|
||||
_$EncryptionContentFromJson(json);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue