Closed krekzsolti closed 2 years ago
Thanks for the request! I have added this feature in version 7.0.0.
For future reference, you can also add this type of functionality yourself via extensions like so:
extension SerializePingResponse on PingResponse {
Map<String, dynamic> toMap() {
return {
'seq': seq,
'ttl': ttl,
'time': time?.inMilliseconds,
'ip': ip,
};
}
}
Unfortunately, since static extensions are not yet available, you would only be able to create a toMap or toJson, not a fromMap or fromJson.
Hi, I would like to save the ping results to a List of PingModel list. The problem is that your data model doesn't have a toMap() method, So I cant convert it to string and save it with sharedpreferences. Maybe your could add these methods to your code?
Thanks anyway, this package is useful. :)