getTripDetailsById function

Future<SingleTripResponse?> getTripDetailsById(
  1. String appTripId
)

Implementation

Future<SingleTripResponse?> getTripDetailsById(
    String appTripId,
    ) async {
  try {
    String? tripDetails = await platform.invokeMethod(
      'getTripDetailsById',
      {"appTripId": appTripId},
    );
    if (kDebugMode) {
      print("Received Trip details from sdk: $tripDetails");
    }
    return SingleTripResponse.fromJson(jsonDecode(tripDetails!));
  } on PlatformException catch (e, stacktrace) {
    if (kDebugMode) {
      print("Error in getTripDetailsById");
      print(e);
      print(stacktrace);
    }
    rethrow;
  } catch (e, stacktrace) {
    if (kDebugMode) {
      print("Error in getTripDetailsById");
      print(e);
      print(stacktrace);
    }
    throw PlatformException(code: "PLUGIN_ERROR", message: e.toString());
  }
}