loadCollections method

Future<void> loadCollections(
  1. String sourceId
)

Implementation

Future<void> loadCollections(String sourceId) async {
  loading = true;
  lastError = null;
  notifyListeners();
  try {
    final result = await _repository.getCollections(sourceId);
    collections = result.map((c) => c.name).toList();
    selectedCollection = null;
    loading = false;
    notifyListeners();
  } catch (error) {
    loading = false;
    lastError = 'Failed to load collections: $error';
    notifyListeners();
  }
}