getPois method

  1. @override
Future<List<Poi>?> getPois([
  1. String? poiID
])
override

The function getPois retrieves a list of Poi objects from a method channel in Dart. @param {String} poiID - The poiID parameter is an optional string that represents the ID of a specific point of interest (POI). If a poiID is provided, the method will retrieve the POI with that specific ID. If no poiID is provided, the method will retrieve all available @returns The method is returning a Future object that resolves to a List of Poi objects.

Implementation

@override
Future<List<Poi>?> getPois([String? poiID]) async {
  final returnVal =
      await methodChannel.invokeMethod<String>('getPois', poiID);
  List<Poi>? pois;
  if (returnVal != null) {
    pois =
        (jsonDecode(returnVal) as List).map((i) => Poi.jsonToObj(i)).toList();
  }
  return pois;
}