Created
October 7, 2020 10:31
-
-
Save mg/d141dbc29d99d81e45dc016e959fb1e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyListNotifier extends ValueNotifier<MyList> { | |
MyListNotifier(MyList myList) : super(myList) { | |
value.setNotifyListeners(notifyListeners); | |
} | |
} | |
class MyList<E> extends List<E> { | |
VoidCallback _notifyListeners; | |
void setNotifyListeners(VoidCallback notifyListeners) { | |
this.notifyListeners = notifyListeners; | |
} | |
@override | |
void add(E element) { | |
super.add(element); | |
_notifyListeners(); | |
} | |
// etc for needed mutating methods | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment