-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Describe the bug
Mutations cannot always be used where ref.read can.
For example, we cannot trigger a mutation in a FutureBuilder future method.
I'm not sure if this is a bug or a limitation of the mutation feature, but I didn't find anything mentioning this limitation.
To Reproduce
<Please add a small sample to that can be executed to reproduce the problem. As a general rule, 100 lines is the maximum>
Try using a mutation inside of a FutureBuilder future, like the following:
Future<String> _myFuture() async {
return myMutation.get(ref);
}And using a FutureBuilder in the widget tree:
FutureBuilder<String>(
future: _myFuture,
builder: (context, snapshot) {
...
}Expected behavior
A clear and concise description of what you expected to happen.
I'm not sure if this should work or not. But I didn't find anything mentioning this limitation of mutations.
If this is indeed not possible, what is the recommended way to retrieve data (ideally using a mutation so we don't have to handle the loading state ourself) on widget initialization?