decode method

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

Implementation

@override
DateTime decode(dynamic value) {
  if (value is String) {
    return DateTime.parse(value);
  } else if (value is num) {
    return DateTime.fromMillisecondsSinceEpoch(value.round());
  } else {
    throw MapperException.unexpectedType(
        value.runtimeType, DateTime, 'String or num');
  }
}