getRoute method

Future<RaliRoute?> getRoute(
  1. String routeId
)

Gets a route by ID

Implementation

Future<RaliRoute?> getRoute(String routeId) async {
  try {
    final docSnapshot = await _firestore.collection(_collectionPath).doc(routeId).get();

    if (docSnapshot.exists) {
      return RaliRoute.fromMap(docSnapshot.data()!, routeId);
    }
    return null;
  } catch (e) {
    print('Error getting route: $e');
    rethrow;
  }
}