Skip to content

Instantly share code, notes, and snippets.

@Vanethos
Created January 13, 2020 08:19
Show Gist options
  • Save Vanethos/25cda626fa829c925b1ea8d00d3fb4f3 to your computer and use it in GitHub Desktop.
Save Vanethos/25cda626fa829c925b1ea8d00d3fb4f3 to your computer and use it in GitHub Desktop.
void mainCommon(Config config) async {
// Create completerto receive the result
final completer = Completer<bool>();
// Run first widget to fetch data from the network
runApp(
SplashPage(completer: completer,)
);
// This will wait for the SplashPage to finish the request.
// It will be `true` if we receive a result from the network and `false` otherwise
bool isLoggedIn = await completer.future;
// Runs the app with the Config and login status information
runApp(
MyApp(config, isLoggedIn)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment