encode method
Encodes value
into this object for key
.
If value
is a DateTime, it is first encoded as an ISO 8601 string.
If value
is a Uri, it is first encoded to a string.
If value
is null, no value is encoded and the key
will not be present
in the resulting archive.
Implementation
void encode(String key, dynamic value) {
if (value == null) {
return;
}
if (value is DateTime) {
_map[key] = value.toIso8601String();
} else if (value is Uri) {
_map[key] = value.toString();
} else {
_map[key] = value;
}
}