decode<T> method
Returns the object associated by key
.
If T
is inferred to be a Uri or DateTime,
the associated object is assumed to be a String and an appropriate value is parsed
from that string.
If this object is a reference to another object (via referenceURI), this object's key-value
pairs will be searched first. If key
is not found, the referenced object's key-values pairs are searched.
If no match is found, null is returned.
Implementation
T? decode<T>(String? key) {
var v = _getValue(key);
if (v == null) {
return null;
}
if (T == Uri) {
return Uri.parse(v) as T;
} else if (T == DateTime) {
return DateTime.parse(v) as T;
}
return v;
}