getTripRouteById function

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

Implementation

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

    final collection = GeoJSONFeatureCollection.fromJSON(geojsonString);

    return collection;
  } on PlatformException catch (e, stacktrace) {
    if (kDebugMode) {
      print("Error in getTripRouteById");
      print(e);
      print(stacktrace);
    }
    rethrow;
  } catch (e, stacktrace) {
    if (kDebugMode) {
      print("Error in getTripRouteById");
      print(e);
      print(stacktrace);
    }
    throw PlatformException(code: "PLUGIN_ERROR", message: e.toString());
  }
}