Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use generic Riverpod Ref in providers #1853

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/app_center/lib/deb/deb_providers.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import 'package:app_center/packagekit/packagekit.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:ubuntu_service/ubuntu_service.dart';

part 'deb_providers.g.dart';

@riverpod
Stream<PackageKitTransaction> transaction(TransactionRef ref, int id) {
Stream<PackageKitTransaction> transaction(Ref ref, int id) {
final transaction = getService<PackageKitService>().getTransaction(id);
if (transaction == null) return const Stream.empty();

Expand Down
4 changes: 2 additions & 2 deletions packages/app_center/lib/manage/updates_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final currentlyRefreshAllSnapsProvider = StateProvider<List<String>>((_) => []);
final isSilentlyCheckingUpdatesProvider = StateProvider<bool>((_) => false);

@Riverpod(keepAlive: true)
bool hasUpdate(HasUpdateRef ref, String snapName) {
bool hasUpdate(Ref ref, String snapName) {
final updatesModel = ref.watch(updatesModelProvider);
return updatesModel.whenOrNull(
data: (updatesData) => updatesData.snaps.any((s) => s.name == snapName),
Expand All @@ -49,7 +49,7 @@ bool hasUpdate(HasUpdateRef ref, String snapName) {
/// Used to see which snaps that are installed but need to be restarted to be
/// refreshed (or be forced to restart after the proceedTime).
@riverpod
Future<List<Snap>> refreshInhibitSnaps(RefreshInhibitSnapsRef ref) async {
Future<List<Snap>> refreshInhibitSnaps(Ref ref) async {
final snapd = getService<SnapdService>();
return snapd.getSnaps(filter: SnapsFilter.refreshInhibited);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/app_center/lib/providers/error_stream_provider.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:ubuntu_service/ubuntu_service.dart';

Expand All @@ -11,7 +12,7 @@ final errorStreamProvider = StreamProvider<Exception>(
);

@Riverpod(keepAlive: true)
ErrorStreamController errorStreamController(ErrorStreamControllerRef ref) {
ErrorStreamController errorStreamController(Ref ref) {
return getService<ErrorStreamController>();
}

Expand Down
6 changes: 3 additions & 3 deletions packages/app_center/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
flutter_localizations:
sdk: flutter
flutter_markdown: ^0.7.3+1
flutter_riverpod: ^2.5.1
flutter_riverpod: ^2.6.1
flutter_svg: ^2.0.10+1
freezed_annotation: ^2.4.4
github: ^9.24.0
Expand All @@ -40,7 +40,7 @@ dependencies:
package_info_plus: ^8.0.2
packagekit: ^0.2.6
path: ^1.9.0
riverpod_annotation: ^2.3.5
riverpod_annotation: ^2.6.1
shimmer: ^3.0.0
snapcraft_launcher: ^0.1.0
snapd: ^0.6.4
Expand All @@ -67,7 +67,7 @@ dev_dependencies:
sdk: flutter
json_serializable: ^6.8.0
mockito: ^5.4.4
riverpod_generator: ^2.4.3
riverpod_generator: ^2.6.1
ubuntu_lints: ^0.4.1

flutter:
Expand Down
Loading