I'm guessing that the following code will FIRST return an empty list, and then later (when the future completes), it will return the actual data provided by the future.
That's all good ... but I'm wondering if my list-data will be retained and cached (thats what I want), or if it will be purged when the future completes.
In other words, does the "historyItemsProvider" rebuild TWICE, or 3 times from the watch below?
final historyItemsProvider =
StateProvider<List<ValuesBehaviorAssessMsg>>((ref) {
// holds all data returned by the API
final data = ref.watch(loadHistoryFutureProvider);
List<ValuesBehaviorAssessMsg> response = [];
data.whenData((vcm) => response = vcm.items);
return response;
});
question from:
https://stackoverflow.com/questions/65557619/what-happens-to-a-riverpod-state-provider-that-is-watching-a-future-after-the-f 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…