This should describe the current issue that comes with our latest project in Android with Flutter.
The startup time of our app is unbelievably bad. From a tap on the icon at the home screen until the first rendered frame in Flutter, it sometimes takes up to 8 seconds.
As you know, a flutter app needs to initialize itself before rendering the first screen. To not have this typical white/black screen you can stylize the look of that “launch screen” via an XML file.
When building the popular Flutter counter app in profile or release mode, this initialization takes less than a second (means: from the tap on the icon until the Counter App screen (the one with the FAB) takes less than a second).
But in our case, it’s much slower.
I thought this might come from the asset folder (because when Flutter initializes, it extracts the assets and such things). But even when everything is removed, the init time is not much better (we can save about 1 or 2 seconds, having 6 left).
Then, it might come from the main() method, but this method is empty and every dependency/plugin initialization is done inside Flutter, after the main() and runApp(MyApp()).
Some facts (and things I’ve played around with to solve that issue without success):
The asset folder contains gifs, lottie files, one mp3 file and some png images. (~5 MB)
Currently used Flutter version: 1.22.0 stable channel
main() is empty and NOT async, just the required runApp();
[login to view URL]() is almost empty, defining just a few MethodChannels
Switching to beta, dev and master channel (as of 01/20/2021) has no positive effect
It might also come from some plugins that cause the app to drown the loading time.
NOTE: It has NOTHING to do with the Flutter screens where you can define your own splash! It is the startup time UNTIL Flutter renders anything.
Have you ever come across such a problem, or have you ever encountered bad loading/startup/launch times in a Flutter app? And how did you solve that?