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

26 lines
395 B
Dart
Raw Permalink Normal View History

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