getTripStatsById function

Future<TripStatsResponse?> getTripStatsById(
  1. String appTripId
)

Implementation

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