@@ -5,7 +5,6 @@ import "package:riverpod_annotation/riverpod_annotation.dart";
55
66import "../../auth/application/auth_service.dart" ;
77import "../data/coins_repository.dart" ;
8- import "../domain/coin_entity.dart" ;
98import "../domain/coins_model.dart" ;
109
1110part "coins_service.g.dart" ;
@@ -15,9 +14,9 @@ part "coins_service.g.dart";
1514base class CoinsService extends _$CoinsService {
1615 @override
1716 FutureOr <CoinsModel > build (int userId) async {
18- final coin = await ref.watch (coinStreamProvider (userId).future);
17+ final coins = await ref.watch (coinStreamProvider (userId).future);
1918
20- return CoinsModel (coins: coin );
19+ return CoinsModel (coins: coins );
2120 }
2221
2322 /// Modify coins in the database.
@@ -43,12 +42,10 @@ base class CoinsService extends _$CoinsService {
4342
4443/// Get the coins of the current user.
4544@riverpod
46- Stream <CoinsModel > currentUserCoins (CurrentUserCoinsRef ref) async * {
47- final userId = await ref.watch (
48- pirateAuthServiceProvider.selectAsync ((data) => data.user.id),
49- );
45+ Future <CoinsModel > currentUserCoins (CurrentUserCoinsRef ref) async {
46+ final userId = await ref.watch (idProvider.future);
5047
51- yield await ref.read (coinsServiceProvider (userId).future);
48+ return ref.read (coinsServiceProvider (userId).future);
5249}
5350
5451/// Get coins data from data layer.
@@ -68,11 +65,3 @@ base class CurrentStage extends _$CurrentStage {
6865 state = const Stage .pickStudent ();
6966 }
7067}
71-
72- /// Get the coins stream
73- @riverpod
74- Stream <CoinEntity > coinStream (CoinStreamRef ref, int userId) async * {
75- final coinsDataRepository = ref.read (coinsDataProvider (userId));
76-
77- yield * coinsDataRepository.coinsData ().asBroadcastStream ();
78- }
0 commit comments