התקינו miniriverpod תוך דקות.

ערכת ניהול מצב בסגנון Riverpod עם ליבה בקובץ יחיד וקישור Flutter דק.

דרישות

ודאו שהפרויקט עומד בגרסאות המינימום של 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

עיינו בקוד המקור, יומן השינויים והדוגמאות במאגר.

פתיחת GitHub

API Reference

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

Open API Reference