Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flutterando/value_selectable
A Flutter package that provides computed values for `ValueNotifier`, inspired by the Selectors from Recoil.
https://github.com/flutterando/value_selectable
Last synced: 3 days ago
JSON representation
A Flutter package that provides computed values for `ValueNotifier`, inspired by the Selectors from Recoil.
- Host: GitHub
- URL: https://github.com/flutterando/value_selectable
- Owner: Flutterando
- License: other
- Created: 2024-06-14T14:37:51.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-30T15:25:40.000Z (7 months ago)
- Last Synced: 2025-01-08T19:54:15.010Z (16 days ago)
- Language: C++
- Homepage: https://pub.dev/packages/value_selectable
- Size: 625 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ValueSelectable
![image](https://github.com/Flutterando/value_selectable/blob/main/assets/image.png?raw=true)
A Flutter package that provides computed values for `ValueNotifier`, inspired by the Selectors from Recoil.
## Overview
This package includes two main classes:
- `ValueSelector`: Computes a synchronous value based on a given scope.
These classes allow you to create computed values that automatically update when their dependencies change, providing a reactive programming model similar to Recoil selectors.
## Features
- Reactive computation of values based on dependencies.
- Synchronous and asynchronous selectors.
- Automatic updates when dependencies change.
- Easy integration with Flutter's ValueNotifier.## Installation
Add the following to your `pubspec.yaml`:
```
flutter pub add value_selectable
```## Usage
### ValueSelector
Computes a synchronous value based on a given scope:
```dart
import 'package:flutter/widgets.dart';
import 'package:value_selectable/value_selectable.dart';void main() {
final valueNotifier = ValueNotifier(1);
final selector = ValueSelector((get) => get(valueNotifier) + 1);print(selector.value); // Outputs: 2
valueNotifier.value = 2;
print(selector.value); // Outputs: 3
}```
## Contributing
Contributions are welcome! Please open an issue or submit a pull request.