Skip to content

Commit

Permalink
feat(user_centauri_points_vm): make refreshWithCentauriPointsNumber n…
Browse files Browse the repository at this point in the history
…ot Future
  • Loading branch information
CHOOSEIT committed May 25, 2024
1 parent 4d15cbb commit f5fc5a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 2 additions & 3 deletions lib/viewmodels/user_centauri_points_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ class UserCentauriPointsViewModel
}

/// Refresh the number of centauri points of the user.
Future<void> refreshWithCentauriPointsNumber(int centauriPoints) async {
state = AsyncValue.data(centauriPoints);
}
void refreshWithCentauriPointsNumber(int centauriPoints) =>
state = AsyncValue.data(centauriPoints);
}

final userCentauriPointsViewModelProvider = AsyncNotifierProvider.family<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "package:flutter/foundation.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:proxima/models/database/user/user_id_firestore.dart";
import "package:proxima/viewmodels/user_centauri_points_view_model.dart";
Expand All @@ -8,16 +9,16 @@ class MockUserAvatarCentauriPointsViewModel
implements UserCentauriPointsViewModel {
final Future<int?> Function(UserIdFirestore? arg) _build;
final Future<void> Function() _onRefresh;
final Future<void> Function() _onRefreshWithCentauriPointsNumber;
final VoidCallback _onRefreshWithCentauriPointsNumber;

MockUserAvatarCentauriPointsViewModel({
Future<int?> Function(UserIdFirestore? arg)? build,
Future<void> Function()? onRefresh,
Future<void> Function()? onRefreshWithCentauriPointsNumber,
VoidCallback? onRefreshWithCentauriPointsNumber,
}) : _build = build ?? ((_) async => null),
_onRefresh = onRefresh ?? (() async {}),
_onRefreshWithCentauriPointsNumber =
onRefreshWithCentauriPointsNumber ?? (() async {});
onRefreshWithCentauriPointsNumber ?? (() {});

@override
Future<int?> build(UserIdFirestore? arg) => _build(arg);
Expand All @@ -26,7 +27,7 @@ class MockUserAvatarCentauriPointsViewModel
Future<void> refresh() => _onRefresh();

@override
Future<void> refreshWithCentauriPointsNumber(int centauriPoints) =>
void refreshWithCentauriPointsNumber(int centauriPoints) =>
_onRefreshWithCentauriPointsNumber();
}

Expand Down

0 comments on commit f5fc5a7

Please sign in to comment.