searchAround static method

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

周边搜索poi

center 中心点

keyword 查询关键字,多个关键字用“|”分割

radius 查询半径,范围:0-50000,单位:米 default = 1500

types 类型,多个类型用“|”分割 可选值:文本分类、分类代码

city 城市名称

pageSize 每页记录数, 范围1-25, default = 20

page 当前页数, 范围1-100, default = 1

Implementation

static Future<List<AMapPoi>> searchAround(
  LatLng center, {
  String keyword = '',
  String city = '',
  String types = '',
  int pageSize = 20,
  int page = 1,
  int radius = 1500,
}) async {
  assert(page >= 1 && page <= 100, 'page must be between 1 and 100');
  assert(pageSize >= 1 && pageSize <= 25, 'pageSize must be between 1 and 25');
  assert(radius >= 0 && radius <= 50000, 'radius must be between 0 and 50000');
  final List? dataList = await _channel.invokeMethod('searchAround', {
    'keyword': keyword,
    'city': city,
    'types': types,
    'pageSize': pageSize,
    'page': page,
    'longitude': center.longitude,
    'latitude': center.latitude,
    'radius': radius,
  });
  return dataList?.map((e) => AMapPoi.fromJson(e)).toList() ?? [];
}