fetchTextSearch method

Future<List<MFPlaceResult>> fetchTextSearch(
  1. String text, {
  2. List<String>? types,
  3. DateTime? datetime,
  4. MFLocationComponent? location,
})

Text search

Implementation

Future<List<MFPlaceResult>> fetchTextSearch(String text,
    {List<String>? types,
    DateTime? datetime,
    MFLocationComponent? location}) async {
  final Map<String, Object> data = <String, Object>{'text': text};

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

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

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