fetchNearbySearch method

Future<List<MFPlaceResult>> fetchNearbySearch(
  1. MFLocationComponent location,
  2. int radius, {
  3. String? text,
  4. List<String>? types,
  5. List<String>? tags,
  6. DateTime? datetime,
})

Nearby search

Implementation

Future<List<MFPlaceResult>> fetchNearbySearch(
  MFLocationComponent location,
  int radius, {
  String? text,
  List<String>? types,
  List<String>? tags,
  DateTime? datetime,
}) async {
  final Map<String, Object> data = <String, Object>{
    'location': location.toJson(),
    'radius': radius,
  };

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

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

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