3
0
Fork 0
trifid_mobile/lib/models/CIDR.dart

26 lines
375 B
Dart
Raw Permalink Normal View History

2020-07-27 20:43:58 +00:00
class CIDR {
CIDR({this.ip, this.bits});
String ip;
int bits;
@override
String toString() {
return '$ip/$bits';
}
String toJson() {
return toString();
}
CIDR.fromString(String val) {
final parts = val.split('/');
if (parts.length != 2) {
throw 'Invalid CIDR string';
}
ip = parts[0];
bits = int.parse(parts[1]);
}
}