getDetails method

Future<AddressDetails> getDetails(
  1. AddressPrediction prediction, {
  2. String? locale,
  3. bool deleteThisPartOfCache = false,
})

Implementation

Future<AddressDetails> getDetails(
  AddressPrediction prediction, {
  String? locale,
  bool deleteThisPartOfCache = false,
}) async {
  final QueryOptions _options = WatchQueryOptions(
    document: gql(getAddressDetails),
    variables: {
      'predictionId': prediction.addressId,
      'locale': locale ?? Intl.getCurrentLocale(),
    },
  );
  final QueryResult result = await _graphQLClient.query(_options);
  checkForError(result);
  if (deleteThisPartOfCache) {
    _graphQLClient.cache.writeQuery(_options.asRequest, data: {});
  }
  return AddressDetails.fromJson(result.data!['address']);
}