I have a hook widget with useValueChanged
listener as follows:
useValueChanged(selectedLayout.value, (_, __) {
changeLayout(selectedLayout.value);
});
and changeLayout(..)
uses useFuture(..)
to make a graphql mutation call and return a Future wrapped inside a AsyncSnapshot
the value is changed in onTap
callback as follows:
onTap: () {
selectedLayout.value = "classic";
},
my HookWidget is throwing type mismatch error. any way to use useFuture()
and useValueChanged()
in same HookWidget?
Bad state: Type mismatch between hooks:
- previous hook: _ValueChangedHook<String, Null>
- new hook: _FutureHook<QueryResult>
I was stuck in
useValueChanged
but I got the way to do it. Here is the code :This worked fine for me.