flutter_pod 0.18.0 flutter_pod: ^0.18.0 copied to clipboard
A dependency injection and state management library, fast, simple and composable inspired by Riverpod and Jōtai.
Pod #
⚠️ Status: Experimental
A dependency injection and state management library, fast, simple and composable.
Inspired by Riverpod and Jōtai
Package | Pub |
---|---|
pod | |
flutter_pod | |
bloc_pod |
Quick Start #
import 'package:flutter/material.dart';
import 'package:flutter_pod/flutter_pod.dart';
/// A pod that asynchronously exposes the current user
final userPod = futurePod<User>((_) async {
// fetch the user
});
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
final AsyncValue<User> user = context.watch(userPod);
return user.when(
loading: () => CircularProgressIndicator(),
error: (error, stack) => Text('Oops, something unexpected happened'),
data: (user) => Text('Hello ${user.name}'),
);
}
}