Quick API lookup for daily work.
This page summarizes commonly used classes and methods from miniriverpod_core.dart and miniriverpod_flutter.dart.
Core Types
Core state and provider primitives.
Provider-identitet
AsyncLoading / AsyncData / AsyncError
Alternativ til family
Synchronous provider with optional autoDispose
DI-fallback
Asynchronous provider with .future selector
Reading tip
AsyncValue does not include a when method; use switch pattern matching or is checks.
Ref and ProviderContainer Methods
Common operational methods for refresh, invalidation, lifecycle, and mutation execution.
Common sequence
Method map
read / watch / listen : read and subscribe to providers.
invalidate / refresh / refreshValue : recompute state.
onDispose / keepAlive / emit : lifecycle and stream wiring.
mutation / mutate / invoke : tracked write operations.
scope / overrideWithValue : DI and testing overrides.
Flutter API Snapshot
ProviderScope + WidgetRef entry points used in app code.
// Scope
ProviderScope(
child: const App(),
);
// ConsumerWidget
class Header extends ConsumerWidget {
const Header({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final user = ref.watch(currentUser);
return Text('$user');
}
}
// Mutation execution
await ref.invoke(userProvider.rename('Alice'));
ProviderScope(container: external) requires manual container.dispose().
UncontrolledProviderScope never disposes injected container.
Consumer, ConsumerWidget, and ConsumerStatefulWidget are all supported.
Næste skridt
Provider og AsyncProvider
Return to practical usage of Provider, AsyncProvider, and read APIs.
Åbn Providers