deserialize method
GeoPoint
deserialize(
- Serializers serializers,
- Iterable<
Object?> serialized, { - FullType specifiedType = FullType.unspecified,
override
Deserializes serialized
.
serialized
is an Iterable that may contain booleans, integers,
doubles, Strings and/or Iterables.
Use serializers
as needed for nested deserialization. Information about
the type being deserialized is provided in specifiedType
.
Implementation
@override
GeoPoint deserialize(
Serializers serializers,
Iterable<Object?> serialized, {
FullType specifiedType = FullType.unspecified,
}) {
late double latitude;
late double longitude;
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String?;
iterator.moveNext();
final dynamic value = iterator.current;
switch (key) {
case 'latitude':
latitude =
serializers.deserialize(value, specifiedType: const FullType(double)) as double;
break;
case 'longitude':
longitude =
serializers.deserialize(value, specifiedType: const FullType(double)) as double;
break;
}
}
return GeoPoint(latitude, longitude);
}