Install miniriverpod in minutes.

Set the SDK constraints, add the package, and confirm that ProviderScope and 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

Tip

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

Installation

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

CLI

pubspec.yaml

# Add to dependencies
dependencies:
  miniriverpod: ^0.0.2

Your first ProviderScope flow

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

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')),
    );
  }
}
Choose Provider((ref) => ...) for synchronous values.
Choose 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