I've been working with flutter-hooks' useFuture method, but I need to use it conditionally (based on user-input in this case). I've found this approach, but I need to know if there is a better way:
Storing what data is selected using useState, and if there is some data selected, change the future from null to the actual future. Example code:
final selected = useState<int>(null);
final future = useMemoizedFuture(() => selected.value != null ? http.get("someapi") : null);