reactive_variables 0.1.0 copy "reactive_variables: ^0.1.0" to clipboard
reactive_variables: ^0.1.0 copied to clipboard

outdated

Simple state manager

Reactive Variables for Flutter #

Make your Flutter app's state management easier with reactive_variables. This package offers a simple way to create reactive variables, ensuring your UI always stays in sync.

🌟 Features: #

  • Simplicity: Create reactive variables without the fuss.
  • UI Synchronization: Widgets automatically refresh when your reactive variables change.
  • Flexibility: Comes with extensions that cater to various data types and collections.

🔧 Installation: #

Add this to your pubspec.yaml:

dependencies:
  reactive_variables: ^0.1.0

💡 How to use: #

1. Create a reactive variable

final Rv<int> count = Rv(0);

or

final count = 0.rv;

2. Listen to changes

count.listen((value) {
  print("Count changed: $value");
});

3. Update the value

count.trigger(5);

4. Auto-refreshing UI

Obs(
  rvList: [count],
  builder: (context) => Text("Current count: ${count.value}"),
);

Using with getters and setters

final Rv<int> rvCount = Rv(0);

int get count => rvCount.value;
set count(int v) => rvCount.trigger(v);

📦 Extensions: #

Easily handle different data types:

final items = <String>{}.rv;
items.add("apple");
items.remove("apple");

📜 License: #

MIT

8
likes
0
points
8
downloads

Publisher

unverified uploader

Weekly Downloads

Simple state manager

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on reactive_variables