fetchSuggestion method

Future<List<MFSuggestionResult>> fetchSuggestion(
  1. String text, {
  2. MFLocationComponent? location,
  3. bool acronym = false,
})

Auto suggest

Implementation

Future<List<MFSuggestionResult>> fetchSuggestion(String text,
    {MFLocationComponent? location, bool acronym = false}) async {
  final Map<String, Object> data = <String, Object>{
    'text': text,
    'acronym': acronym,
  };

  if (location != null) {
    data['location'] = location.toJson();
  }

  final response =
      await _ServicesChannel.invokeService('place#autosuggest', data);
  validateResponse(response);

  return toListSuggestion(response!['result']);
}