Install miniriverpod in minutes.

Set SDK constraints, add the package, and confirm ProviderScope + WidgetRef.watch are wired correctly.

Requirements

Use the same constraints as the package to avoid analyzer and runtime mismatch.

Dart SDK

>=3.10.0 <4.0.0

Flutter

>=3.38.0

Tip

If your app is pinned below Dart 3.10, raise SDK constraints first, then run flutter pub get.

Installation

Prefer CLI install, then keep the version aligned with the package changelog.

CLI

flutter pub add miniriverpod

pubspec.yaml

# Add to dependencies
dependencies:
  miniriverpod: ^0.0.2

First Steps

Wrap your app in ProviderScope, define a Provider, and render state from ConsumerWidget.

main.dart
import 'package:flutter/widgets.dart';
import 'package:miniriverpod/miniriverpod.dart';

final counterProvider = Provider<int>((ref) => 0);

void main() {
  runApp(const ProviderScope(child: CounterApp()));
}

class CounterApp extends ConsumerWidget {
  const CounterApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final count = ref.watch(counterProvider);
    return Directionality(
      textDirection: TextDirection.ltr,
      child: Center(child: Text('$count')),
    );
  }
}
Use Provider((ref) => ...) for synchronous values.
Use AsyncProvider<T>((ref) async => ...) for Future and ref.emit(stream) for Stream.
Switch to ref.invoke(provider.method()) when you implement mutations.

Next Steps

Core Concepts

Understand args-based provider identity, Scope injection, and no-codegen design choices.

Open Core Concepts

Providers & Reads

Learn watch/read/listen behavior and AsyncProvider refresh patterns.

Open Providers

API Reference

Quickly lookup methods such as invalidate, refreshValue, keepAlive, and invoke.

Open API Reference