Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Transient<T> {
- T _value;
- Transient(T value) {
- this._value = value;
- }
- void use(Function(T value) block) {
- assert(block != null);
- if (_value != null) {
- block(_value);
- _value = null;
- }
- }
- }
- class Event {
- Object _flag = Object();
- void consume(Function block) {
- assert(block != null);
- if (_flag != null) {
- block();
- _flag = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement