decode method

  1. @override
DateTime decode(
  1. dynamic d
)

Implementation

@override
DateTime decode(dynamic d) {
  if (d is String) {
    return DateTime.parse(d);
  } else if (d is num) {
    return DateTime.fromMillisecondsSinceEpoch(d.round());
  } else {
    throw MapperException('Cannot decode value of type ${d.runtimeType} to type DateTime, because a value of type String or num is expected.');
  }
}