setLocation method

Future<void> setLocation(
  1. AddressId addressId,
  2. Address address
)

Sets a new Address where AddressId declares.

Implementation

Future<void> setLocation(AddressId addressId, Address address) async {
  if (addressId == AddressId.origin) {
    _origin = address;
    _originController.text = address.reference ?? '';
  } else if (addressId == AddressId.destination) {
    _destination = address;
    _destinationController.text = address.reference ?? '';
  } else if (addressId == AddressId.waypoint) {
    addWaypoint(address);
  }
  notifyListeners();
}