I-install ang miniriverpod sa loob ng ilang minuto.

Isang lightweight Riverpod-style state management toolkit na may single-file core at manipis na Flutter binding.

Requirements

Tiyakin na tugma ang project sa minimum SDK at Flutter versions.

Dart SDK

>=3.10.0 <4.0.0

Flutter

>=3.38.0

Tip

Kung nag-a-upgrade ng existing project, i-update muna ang SDK constraints bago mag-install.

Installation

Idagdag ang package gamit ang Flutter CLI o i-update ang pubspec manually.

CLI

flutter pub add miniriverpod

pubspec.yaml

# Add to your dependencies
dependencies:
  miniriverpod: ^0.0.1

First Steps

I-wire ang ProviderScope, magdeklara ng Provider, at i-watch mula sa UI.

main.dart
// 1) Wrap your app with ProviderScope
void main() {
  runApp(
    const ProviderScope(
      child: MyApp(),
    ),
  );
}

// 2) Define a Provider
final counterProvider = Provider<int>((ref) => 0);

// 3) Watch from UI
class MyApp extends ConsumerWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final count = ref.watch(counterProvider);
    return Directionality(
      textDirection: TextDirection.ltr,
      child: Center(child: Text('$count')),
    );
  }
}
Provider((ref) => ...) ay synchronous.
AsyncProvider<T>((ref) async => ...) ay para sa Future o Stream.
Mula sa UI, mag-subscribe gamit ang WidgetRef.watch(provider).

Next Steps

Usage Guide

Alamin kung bakit miniriverpod ay parang Riverpod pero walang overhead.

Buksan ang Guide

GitHub

Tingnan ang source, changelog, at samples sa repo.

Buksan ang GitHub

API Reference

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

Open API Reference