diff --git a/lib/core/models.dart b/lib/core/models.dart index e23c04cc..20ff46f6 100644 --- a/lib/core/models.dart +++ b/lib/core/models.dart @@ -107,6 +107,12 @@ enum UsbPid { @freezed class Version with _$Version implements Comparable { const Version._(); + @Assert('major >= 0') + @Assert('major < 256') + @Assert('minor >= 0') + @Assert('minor < 256') + @Assert('patch >= 0') + @Assert('patch < 256') const factory Version(int major, int minor, int patch) = _Version; factory Version.fromJson(List values) { diff --git a/lib/core/models.freezed.dart b/lib/core/models.freezed.dart index 3f269401..91e5f4ac 100755 --- a/lib/core/models.freezed.dart +++ b/lib/core/models.freezed.dart @@ -106,7 +106,14 @@ class __$$_VersionCopyWithImpl<$Res> extends _$VersionCopyWithImpl<$Res> /// @nodoc class _$_Version extends _Version { - const _$_Version(this.major, this.minor, this.patch) : super._(); + const _$_Version(this.major, this.minor, this.patch) + : assert(major >= 0), + assert(major < 256), + assert(minor >= 0), + assert(minor < 256), + assert(patch >= 0), + assert(patch < 256), + super._(); @override final int major;