Closed 0Nom4D closed 8 months ago
Both futures are waited at the same time using the Future.wait(List<Future>)
method.
CircularProgressIndicator
, widget showing that the Manifest and the articles are fetched from the API, now shows only once.
You can check the current fix here (1561dd6).
Note that this fix is a really tiny fix but I found very annoying to have my CircularProgressIndicator
show twice while I wanted it to show only once.
This fix will be merged in the next PR.
Current issue
When launching the app, the user will land on the home view. When created the home view has this behaviour:
https://github.com/0Nom4D/GuardianDock/blob/336b2e79f4931b81ede974c3ba3eaf65058067dd/lib/src/views/home_view.dart#L18-L47
Future<void>
callback directly with the callback.This triggers the getManifest() callback twice, making the CircularProgressIndicator appear twice in a row.
In order to comply with Flutter guidelines and to fix this unexpected behaviour, I need to follow the following guideline:
"The future must have been obtained earlier, e.g. during State.initState, State.didUpdateWidget, or State.didChangeDependencies. It must not be created during the State.build or StatelessWidget.build method call when constructing the FutureBuilder. If the future is created at the same time as the FutureBuilder, then every time the FutureBuilder's parent is rebuilt, the asynchronous task will be restarted."
This guideline states that the Future callback directly called from the build method should be created inside the
initState
method.Fix
In order to fix this behaviour, I'm going to do the following: