An Idea for simplified dispose effects #176
YousefAK009
started this conversation in
Ideas
Replies: 2 comments 5 replies
-
I used Bard to translate this document, as I am not a native English speaker. |
Beta Was this translation helpful? Give feedback.
3 replies
-
I solved this problem in my package by having final myGroup = BeaconGroup();
final name = myGroup.writable('Bob');
final age = myGroup.writable(20);
myGroup.effect(() {
print(name.value); // Outputs: Bob
});
age.value = 21;
name.value = 'Alice';
myGroup.resetAll(); // resets beacons but does nothing to the effect
print(name.value); // Bob
print(age.value); // 20
myGroup.disposeAll();
print(name.isDisposed); // true
print(age.isDisposed); // true
// All beacons and effects are disposed |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem:
Managing disposable resources in Flutter applications can be cumbersome, leading to potential memory leaks and code clutter. This proposal introduces a helper library to simplify effect and state disposal.
Key Features:
Benefits:
Proposed Enhancement:
Introduce a simplified syntax like
effect(() { ... }, disposer: disposer);
for associating effects with a Disposer.Beta Was this translation helpful? Give feedback.
All reactions