When using providers, how can I listen to a value change in the provider class?
In the code below, when _myData
changes, I want to change _allData
as well. (I know I can just change them both together, but the code below is a stripped version of what I have)
class CoolProvider extends ChangeNotifier {
List<String> _allData = [];
List<String> _myData = [];
List<OrdersResponse> get allData => _allData;
List<OrdersResponse> get myData => _myData;
void changeData() {
_allData = ['yo', 'bro'];
notifyListeners();
}
}