getAllReleases method

Future<List<AppRelease>> getAllReleases()

Get all releases for this app

Implementation

Future<List<AppRelease>> getAllReleases() async {
  try {
    final querySnapshot = await _firestore
        .collection(collectionName)
        .where('package_name', isEqualTo: packageName)
        .orderBy('build_number', descending: true)
        .get();

    return querySnapshot.docs.map((doc) {
      final data = doc.data();
      data['id'] = doc.id;
      return AppRelease.fromJson(data);
    }).toList();
  } catch (e) {
    debugPrint('❌ Error fetching releases: $e');
    return [];
  }
}