getPublicRoutes method

Future<List<RaliRoute>> getPublicRoutes()

//////////// //////////// Gets all public routes

Implementation

// II.C - Query Operations
///////////////
/// Gets all public routes
Future<List<RaliRoute>> getPublicRoutes() async {
  try {
    final querySnapshot = await _firestore
        .collection(_collectionPath)
        .where('isPublic', isEqualTo: true)
        .get();

    return querySnapshot.docs.map((doc) =>
        RaliRoute.fromMap(doc.data(), doc.id)
    ).toList();
  } catch (e) {
    print('Error getting public routes: $e');
    rethrow;
  }
}