Menu

A Flutter App Startup That Never Waits on the Network
📰

A Flutter App Startup That Never Waits on the Network

DEV Community: flutter·Ayesha Iftikhar·14 days ago
#Mth69d9X
#devtoflutter#devto#dev#network#await
Reading 0:00
15s threshold

What runs before runApp() in Mindleau, in what order, and why every one of those awaits is local.

Short answer: In Mindleau, everything awaited before runApp() reads only from the device: Firebase's local config, the .env file, SharedPreferences and the SQLite database. Anything that needs the network, such as sync, ads, purchases and account cleanup, is started afterwards with unawaited() or a post-frame callback, and none of it can throw out of main() . The result is an app that opens the same way on a train with no signal as it does on Wi-Fi.

Most Flutter apps grow their main() one await at a time. Each line is reasonable on its own: initialize Firebase, load config, set up analytics, sign in, fetch remote config, start the ad SDK. Then one day someone opens the app in a lift and stares at the splash screen for twenty seconds.

Mindleau is a journaling app. People open it when their head is crowded, which is often when they're somewhere inconvenient.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.