how to prevent function getting executred twice in build method flutte code example
Example: flutter futurebuilder future called twice
The future is firing again because you're creating it in the build method at the same time as the FutureBuilder.
From the FutureBuilder docs:
The future must have been obtained earlier, e.g. during State.initState