MBAddressElement constructor

MBAddressElement({
  1. required Map<String, dynamic> dictionary,
})

Initializes an address element with the dictionary returned by the MBurger APIs.

  • Parameters:
    • dictionary: The dictionary returned by the APIs.

Implementation

factory MBAddressElement({required Map<String, dynamic> dictionary}) {
  String? address;
  double? latitude;
  double? longitude;
  if (dictionary['value'] is Map<String, dynamic>) {
    Map<String, dynamic> addressDictionary =
        dictionary['value'] as Map<String, dynamic>;
    address = addressDictionary['address'] != null
        ? addressDictionary['address'] as String
        : null;
    latitude = addressDictionary['latitude'] != null
        ? addressDictionary['latitude'] as double
        : null;
    longitude = addressDictionary['longitude'] != null
        ? addressDictionary['longitude'] as double
        : null;
  }
  return MBAddressElement._(
    dictionary: dictionary,
    address: address,
    latitude: latitude,
    longitude: longitude,
  );
}