Skip to content

Commit

Permalink
improve: 不要な Future を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsutakein committed Sep 25, 2023
1 parent 4b40efc commit e5b026c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/features/sponsor/data/sponsor_data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SponsorDataSource sponsorDataSource(SponsorDataSourceRef ref) =>
SponsorDataSource();

final class SponsorDataSource {
Future<List<Sponsor>> fetchSponsors() async {
List<Sponsor> fetchSponsors() {
return [
..._platinumSponsors,
..._goldSponsors,
Expand Down
6 changes: 3 additions & 3 deletions lib/features/sponsor/data/sponsor_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'sponsor_provider.g.dart';

@riverpod
Future<List<Sponsor>> sponsors(SponsorsRef ref) =>
List<Sponsor> sponsors(SponsorsRef ref) =>
ref.watch(sponsorDataSourceProvider).fetchSponsors();

@riverpod
Future<Sponsor?> sponsor(SponsorRef ref, String name) async {
final sponsors = await ref.watch(sponsorsProvider.future);
Sponsor? sponsor(SponsorRef ref, String name) {
final sponsors = ref.watch(sponsorsProvider);
return sponsors.firstWhereOrNull((element) => name == element.name);
}
14 changes: 7 additions & 7 deletions lib/features/sponsor/data/sponsor_provider.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e5b026c

Please sign in to comment.