mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 18:22:39 +03:00
Add asserts for Version parameter ranges.
This commit is contained in:
parent
627e6bdadd
commit
4c34b69c8d
@ -107,6 +107,12 @@ enum UsbPid {
|
||||
@freezed
|
||||
class Version with _$Version implements Comparable<Version> {
|
||||
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<dynamic> values) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user