cached_query
cached_query copied to clipboard
Integrating with Riverpod
It would be nice to have some documentation on integrating with Riverpod. I have a simple stream provider that ingests a function that returns a query stream and maps the result.
final todoProvider = StreamProvider.autoDispose<GetTodoResponse>(
(ref) async* {
...
await for (var element in todoService.get()) {
if (element.data != null) yield element.data!;
if (element.status == QueryStatus.success) yield element.data!;
}
},
);
It's not completely obvious how I would want to map the different states.