deserialize method

  1. @override
DateTime deserialize(
  1. Serializers serializers,
  2. Object serialized, {
  3. FullType specifiedType = FullType.unspecified,
})
override

Deserializes serialized.

serialized is a boolean, an integer, a double or a String.

Use serializers as needed for nested deserialization. Information about the type being deserialized is provided in specifiedType.

Implementation

@override
DateTime deserialize(
  Serializers serializers,
  Object serialized, {
  FullType specifiedType = FullType.unspecified,
}) {
  if (!(serialized is int)) {
    throw Exception(
      "DateSerializer expected 'int' but got ${serialized.runtimeType}",
    );
  }
  return DateTime.fromMillisecondsSinceEpoch(serialized);
}