import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/models/shared_link/shared_link.model.dart'; import 'package:immich_mobile/services/shared_link.service.dart'; class SharedLinksNotifier extends StateNotifier>> { final SharedLinkService _sharedLinkService; SharedLinksNotifier(this._sharedLinkService) : super(const AsyncLoading()) { fetchLinks(); } Future fetchLinks() async { state = await _sharedLinkService.getAllSharedLinks(); } Future deleteLink(String id) async { await _sharedLinkService.deleteSharedLink(id); state = const AsyncLoading(); fetchLinks(); } } final sharedLinksStateProvider = StateNotifierProvider>>( (ref) { return SharedLinksNotifier( ref.watch(sharedLinkServiceProvider), ); });