pod 0.18.0 copy "pod: ^0.18.0" to clipboard
pod: ^0.18.0 copied to clipboard

A dependency injection and state management library, fast, simple and composable inspired by Riverpod and Jōtai.

example/lib/main.dart

import 'package:pod/pod.dart';

void main() {
  // Create a state pod.
  final counterPod = statePod(1);

  // Create a derived Pod.
  final counterTimesTwoPod = pod((ref) => ref.watch(counterPod) * 2);

  // Create a pod container.
  final container = PodContainer();

  // Print derived pod's value.
  print(container.get(counterTimesTwoPod)); // 2

  // Subscribe derived pod's value changes.
  final cancelSubscribe = container.subscribe(counterTimesTwoPod, (value) {
    print(value); // 4
  });

  // Set the value of counter pod to 2.
  container.set(counterPod, 2);

  // Cancel derived pod's subscribe.
  cancelSubscribe();
}
5
likes
160
pub points
43%
popularity

Publisher

verified publishereronsoft.com

A dependency injection and state management library, fast, simple and composable inspired by Riverpod and Jōtai.

Homepage
Repository (GitHub)
View/report issues

Topics

#riverpod #pod #atom #dependency-injection #state-management

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on pod