GeoPointAddress.deserialize constructor

GeoPointAddress.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory GeoPointAddress.deserialize(BinaryReader reader) {
  // Read [GeoPointAddress] fields.
  final flags = reader.readInt32();
  final countryIso2 = reader.readString();
  final hasStateField = (flags & 1) != 0;
  final state = hasStateField ? reader.readString() : null;
  final hasCityField = (flags & 2) != 0;
  final city = hasCityField ? reader.readString() : null;
  final hasStreetField = (flags & 4) != 0;
  final street = hasStreetField ? reader.readString() : null;

  // Construct [GeoPointAddress] object.
  final returnValue = GeoPointAddress(
    countryIso2: countryIso2,
    state: state,
    city: city,
    street: street,
  );

  // Now return the deserialized [GeoPointAddress].
  return returnValue;
}