queryRenderedFeatures method

Future<List> queryRenderedFeatures({
  1. required Point<double> point,
  2. List<String>? layerIds,
  3. List<Object>? filter,
})

Query the map for rendered features We only response the data of Point while click on the map.

Implementation

Future<List> queryRenderedFeatures(
    {required Point<double> point,
    List<String>? layerIds,
    List<Object>? filter}) async {
  try {
    final Map<dynamic, dynamic> reply = await _methodChannel.invokeMethod(
      MethodChannelEvent.queryRenderedFeatures,
      <String, Object?>{
        'x': point.x,
        'y': point.y,
        'layerIds': layerIds,
        'filter': filter,
      },
    );
    return reply['features'].map((feature) => jsonDecode(feature)).toList();
  } on PlatformException catch (e) {
    return Future.error(e);
  }
}