Instaloni miniriverpod ne pak minuta.

Mjet i lehte i menaxhimit te gjendjes ne stilin Riverpod me nje berthame ne nje file dhe lidhje te holle me Flutter.

Kerkesa

Sigurohuni qe projekti juaj ploteson versionet minimale te SDK dhe Flutter.

Dart SDK

>=3.10.0 <4.0.0

Flutter

>=3.38.0

Keshille

Nese po perditesoni nje projekt ekzistues, perditesoni fillimisht kufijte e SDK para komandes se instalimit.

Instalim

Shtoni paketen me Flutter CLI ose perditesoni pubspec manualisht.

CLI

flutter pub add miniriverpod

pubspec.yaml

# Add to your dependencies
dependencies:
  miniriverpod: ^0.0.1

Hapat e pare

Lidhni ProviderScope, percaktoni nje Provider dhe ndiqeni nga 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) => ...) eshte sinkron.
AsyncProvider<T>((ref) async => ...) trajton Future ose Stream.
Nga UI, abonohuni me WidgetRef.watch(provider).

Hapat e ardhshem

Udhezues perdorimi

Zbuloni pse miniriverpod ndihet si Riverpod pa ngarkese.

Hap udhezuesin

GitHub

Shfletoni burimin, changelog dhe shembujt.

Hap GitHub

API Reference

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

Open API Reference