miniriverpod ని నిమిషాల్లో ఇన్స్టాల్ చేయండి.
ఒకే ఫైల్ core మరియు thin Flutter binding తో లైట్ Riverpod-శైలి state management టూల్కిట్.
అవసరాలు
మీ ప్రాజెక్ట్ కనిష్ఠ SDK మరియు Flutter వెర్షన్లను కలిగి ఉందని నిర్ధారించండి.
Dart SDK
>=3.10.0 <4.0.0
Flutter
>=3.38.0
సూచన
ఇప్పటికే ఉన్న ప్రాజెక్ట్ను అప్గ్రేడ్ చేస్తుంటే, ఇన్స్టాల్ కమాండ్ రన్నింగ్ ముందు SDK constraints ను నవీకరించండి.
ఇన్స్టాలేషన్
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) => ...) synchronous.
AsyncProvider<T>((ref) async => ...) Future లేదా Stream ను హ్యాండిల్ చేస్తుంది.
UI నుండి WidgetRef.watch(provider) తో subscribe చేయండి.
తదుపరి అడుగులు
ఉపయోగ గైడ్
miniriverpod ఎందుకు Riverpod లా అనిపిస్తుందో — overhead లేకుండా — తెలుసుకోండి.
గైడ్ తెరవండిAPI Reference
Quickly lookup methods such as invalidate, refreshValue, keepAlive, and invoke.
Open API Reference