decodeString method
Decodes string
to an instance of T
.
Implementation
@override
DateTime decodeString(String string) {
final result = DateTime.tryParse(string);
if (result != null) {
return _convertDecoded(result);
}
final intValue = int.tryParse(string);
if (intValue != null) {
return _convertDecoded(
DateTime.fromMicrosecondsSinceEpoch(intValue, isUtc: true),
);
}
throw ArgumentError.value(string);
}