mirror of
https://github.com/austinried/subtracks.git
synced 2026-06-27 14:14:29 +02:00
refresh lists on source change and sync
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
import '../state/services.dart';
|
||||
import '../state/source.dart';
|
||||
|
||||
void useOnSourceChange(WidgetRef ref, void Function(int sourceId) callback) {
|
||||
final sourceId = ref.watch(sourceIdProvider);
|
||||
|
||||
useEffect(() {
|
||||
callback(sourceId);
|
||||
return;
|
||||
}, [sourceId]);
|
||||
}
|
||||
|
||||
void useOnSourceSync(WidgetRef ref, void Function() callback) {
|
||||
final syncService = ref.watch(syncServiceProvider);
|
||||
|
||||
useOnListenableChange(syncService, () {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user