import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:mirror_core/mirror_core.dart'; final programsApiProvider = Provider((ref) { return ProgramsApiClient(baseUrl: 'http://192.168.86.172:8091'); }); final programsProvider = AsyncNotifierProvider>(ProgramsNotifier.new); class ProgramsNotifier extends AsyncNotifier> { @override Future> build() async { final client = ref.read(programsApiProvider); return client.fetchPrograms(); } Future refresh() async { state = const AsyncValue.loading(); state = await AsyncValue.guard(() async { final client = ref.read(programsApiProvider); return client.fetchPrograms(); }); } }