flutter_hooks_lint_plugin
flutter_hooks_lint_plugin copied to clipboard
Non constant hooks considered constant
I have a useQuery
hook that returns a record (tuple) of the selected state, and the refetch function.
Inside another hook I use useQuery
and create a new function that uses refetch in a useCallback
:
final execute = useCallback(
() async {
skip.value = false;
return refetch();
},
[refetch],
);
Refetch is noted as being unneeded by the linter: Unnecessary key 'refetch' found. Remove the key, or ignore this line.dart(exhaustive_keys)
.
My settings do not have the useQuery
hook as a constant, but I notice some other hooks also not noted as constant, like useAnimationController
, also exhibit the same effect of being incorrectly noted as unneeded in a dependency array because I assume they are being treated as constant by the analyzer.
I am wondering if there is a way to correct this on my end of if a fix is required to the analyser.