mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-24 02:33:44 +03:00
Add asserts for Version parameter ranges.
This commit is contained in:
parent
627e6bdadd
commit
4c34b69c8d
@ -107,6 +107,12 @@ enum UsbPid {
|
|||||||
@freezed
|
@freezed
|
||||||
class Version with _$Version implements Comparable<Version> {
|
class Version with _$Version implements Comparable<Version> {
|
||||||
const 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;
|
const factory Version(int major, int minor, int patch) = _Version;
|
||||||
|
|
||||||
factory Version.fromJson(List<dynamic> values) {
|
factory Version.fromJson(List<dynamic> values) {
|
||||||
|
@ -106,7 +106,14 @@ class __$$_VersionCopyWithImpl<$Res> extends _$VersionCopyWithImpl<$Res>
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
||||||
class _$_Version extends _Version {
|
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
|
@override
|
||||||
final int major;
|
final int major;
|
||||||
|
Loading…
Reference in New Issue
Block a user