په څو دقيقو کې miniriverpod نصب کړئ.

يو سپک Riverpod-سټايل state management toolkit چې يو فایل اصلي core او نازک Flutter binding لري.

اړتياوې

ډاډ ترلاسه کړئ چې ستاسو پروژه د SDK او Flutter لږ تر لږه نسخې پوره کوي.

Dart SDK

>=3.10.0 <4.0.0

Flutter

>=3.38.0

لارښوونه

که موجوده پروژه اپګريډوئ، د نصب کمانډ له چلولو مخکې خپل SDK محدوديتونه تازه کړئ.

نصب

د Flutter CLI سره پکېج اضافه کړئ، يا pubspec په لاس تازه کړئ.

CLI

flutter pub add miniriverpod

pubspec.yaml

# Add to your dependencies
dependencies:
  miniriverpod: ^0.0.1

لومړني ګامونه

ProviderScope وتړئ، Provider اعلان کړئ، او له 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) => ...) سنکرون دی.
AsyncProvider<T>((ref) async => ...) د Future يا Stream لپاره دی.
له UI څخه WidgetRef.watch(provider) سره سبسکرايب کړئ.

راتلونکې ګامونه

د کارولو لارښود

ولې miniriverpod د Riverpod په شان احساس ورکوي زده کړئ.

لارښود پرانېزئ

GitHub

په رېپو کې سرچينه، changelog، او نمونې وګورئ.

GitHub پرانېزئ

API Reference

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

Open API Reference