serialize method

  1. @override
Iterable<Object?> serialize(
  1. Serializers serializers,
  2. GeoPoint object, {
  3. FullType specifiedType = FullType.unspecified,
})
override

Serializes object.

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

Returns an Iterable of values that can be represented as structured JSON: booleans, integers, doubles, Strings and Iterables.

TODO(davidmorgan): document the wire format.

Implementation

@override
Iterable<Object?> serialize(
  Serializers serializers,
  GeoPoint object, {
  FullType specifiedType = FullType.unspecified,
}) {
  final result = <Object?>[
    'latitude',
    serializers.serialize(object.latitude, specifiedType: const FullType(double)),
    'longitude',
    serializers.serialize(object.longitude, specifiedType: const FullType(double)),
  ];

  return result;
}