Closed yoonjikimkr closed 8 months ago
abstract interface class TagRepository{Future getTagCounts();}
getTagCounts() async { supabase.rpc('get_tag_counts'); return Result.success(data);}
final getIt = GetIt.instance; void registerDependencies() { // repositories /..registerSingleton( TagRepositoryImpl(), );/ // usecases / // topsearch ..registerSingleton( TopsearchUseCase( tagRepository: getIt(), ), );/ // view models /..registerFactory( () => HomeViewModel( topsearchUseCase: getIt(), ), )/
await _tagRepository.getTagCounts(); return topTagsResult.when(success: (topTags) { return Result.success(topTags);},
getToptags() /_homeState = homeState.copyWith( isLoading: true, topTags: topTagsList); notifyListeners();/
@freezed List<Map<String, dynamic>> topTags
'${homeState.topTags[index]['tag']}',
Clean Architecture
1. TagRepository
2. TagRepositoryImpl
3. dependency injection
4. TopsearchUseCase
5. HomeViewModel
6. HomeState
7. HomeScreen