'iterate in a multilist provider
I fetch a future from DB, a List<List> ...each sublist contains 3 variables.
I assign the list to a provider.
class SomeProvider with ChangeNotifier{
List<List<dynamic>?>? _fetchedDataList;
String? _one;
String? _two;
String? _three;
}
List<List<dynamic>?>? get fetchedDataList => _fetchedDataList;
String? get first => _first;
String? get one => _one;
String? get two => _two;
String? get three => _three;
void setFetchedDataList(List<List<dynamic>?>? theList){
_fetchedDataList = theList;
}
void setOne(String? one){
_one = one;
}
in the widget I set the provider :
providerClass = Provider.of<SomeProvider>(context);
queryDB.then(theFutureResult){
providerClass.setFetchedDataList(theFutureResult);
}
Now...how to iterate through the fetchedDataList to get the values of the variables for each sub list ? cuz I need assign each 3 variables in separate Container's texts the provider get method of each variable.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
