fetchRoute function

Future<GeoJSONFeatureCollection?> fetchRoute(
  1. String appTripId
)

Implementation

Future<GeoJSONFeatureCollection?> fetchRoute(String appTripId) async {
  try {
    String? geojsonString = await platform.invokeMethod('fetchRoute', {
      "appTripId": appTripId,
    });
    if (kDebugMode) {
      print("Received GeoJsonFeatureCollection from sdk: $geojsonString");
    }
    if (geojsonString == null || geojsonString.isEmpty) {
      return null;
    }

    final collection = GeoJSONFeatureCollection.fromJSON(geojsonString);

    return collection;
  } catch (e, stacktrace) {
    if (kDebugMode) {
      print("Error in fetchRoute");
      print(e);
      print(stacktrace);
    }
    return null;
  }
}