feat(category): add autocomplete for subcategories

This commit is contained in:
JiWoong Sul
2025-12-01 18:16:28 +09:00
parent 0e75a23ade
commit 69902bbc30
4 changed files with 139 additions and 14 deletions

View File

@@ -78,6 +78,21 @@ final categoriesProvider = StreamProvider<List<String>>((ref) {
});
});
/// 세부 카테고리 목록 Provider
final subCategoriesProvider = StreamProvider<List<String>>((ref) {
final restaurantsStream = ref.watch(restaurantListProvider.stream);
return restaurantsStream.map((restaurants) {
final subCategories =
restaurants
.map((r) => r.subCategory)
.where((s) => s.isNotEmpty)
.toSet()
.toList()
..sort();
return subCategories;
});
});
/// 맛집 관리 StateNotifier
class RestaurantNotifier extends StateNotifier<AsyncValue<void>> {
final RestaurantRepository _repository;