with_value 0.0.4 copy "with_value: ^0.0.4" to clipboard
with_value: ^0.0.4 copied to clipboard

Simple InheritedWidget Wrapper.

IMPORTANT #

This is a simple state management library used in packages. I don't want to rely on Provider as a dependency.

The selector is straight out of Provider.

There is no support for this package; please use Provider if you want InheritedWidget as state management.

WithValue #

  • WithValue is an InheritedWidget that allows you to provide a value to a subtree of widgets and retrieve that value using WithValue.of<T>(context).
  • Make sure to override the == and hashCode methods for non-primitive types to ensure proper functionality.
  • Example usage:
WithValue<int>(
  value: 42,
  child: MyWidget(),
)

int value = WithValue.of<int>(context);

Usage #

  • WithValueUpdate is an InheritedNotifier that allows you to provide and update a value to a subtree of widgets and retrieve that value using WithValueUpdate.of<T>(context).
  • Make sure to override the == and hashCode methods for non-primitive types to ensure proper functionality.
  • Example usage:
WithValueUpdate<MyNotifier>(
  notifier: myNotifier,
  child: MyWidget(),
)

MyNotifier notifier = WithValueUpdate.of<MyNotifier>(context);

1
likes
150
points
36
downloads

Publisher

unverified uploader

Weekly Downloads

Simple InheritedWidget Wrapper.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

collection, flutter

More

Packages that depend on with_value