searchAround static method

Future<List<AMapPoi>> searchAround(
  1. Location center, {
  2. String keyword = '',
  3. String city = '',
  4. int pageSize = 20,
  5. int page = 1,
  6. int radius = 1000,
})

周边搜索poi

在中心点center周边搜索关键字keyword和城市city的poi, 可以设置每页数量pageSize和第page

Implementation

static Future<List<AMapPoi>> searchAround(
  Location center, {
  String keyword = '',
  String city = '',
  int pageSize = 20,
  int page = 1,
  int radius = 1000,
}) async {
  assert(page > 0 && page < 100, '页数范围为1-100');
  assert(pageSize > 0 && pageSize < 50, '每页大小范围为1-50');

  final List? dataList = await _channel.invokeMethod('searchAround', {
    'keyword': keyword,
    'city': city,
    'pageSize': pageSize,
    'page': page,
    'longitude': center.longitude,
    'latitude': center.latitude
  });
  return dataList?.map((e) {
        return AMapPoi.fromJson(e);
      }).toList() ??
      [];
}