I am learning flutter. I have few doubts.
For flutter app to run we do need a flutter engine, right?
But when I download a flutter app from Play Store(android) or App store(ios) when do the flutter engine gets installed into mobile ?
For a reference I have saw this https://github.com/flutter/flutter/issues/56863 , is this how it happens ?
CodePudding user response:
The engine is compiled into the apk/app bundle. This leads to flutter apps always having an apk size of 15 MBs minimum. However, I don't think this is a huge disadvantage. Of course, it's nice when your app is small, but nowdays, there are very little phones that do not have enough storage. Plus, 15 MBs is not huge, there are games that go up to 5 GBs.
The issue you mentioned is a proposal but not reality, and the Flutter Team can't do much for that becoming reality.
CodePudding user response:
As from the official flutter docs website :
Flutter provides a set of widgets (including Material Design and Cupertino (iOS-styled) widgets), managed and rendered by Flutter’s framework and engine.
Also :
In March 2021, we measured the download size of a minimal Flutter app (no Material Components, just a single Center widget, built with flutter build apk --split-per-abi), bundled and compressed as a release APK, to be approximately 4.3 MB for ARM32, and 4.8 MB for ARM64.
On ARM32, the core engine is approximately 3.4 MB (compressed), the framework app code is approximately 765 KB (compressed), the LICENSE file is 58 KB (compressed), and necessary Java code (classes.dex) is 120 KB (compressed).
In ARM64, the core engine is approximately 4.0 MB (compressed), the framework app code is approximately 659 KB (compressed), the LICENSE file is 58 KB (compressed), and necessary Java code (classes.dex) is 120 KB (compressed).
These numbers were measured using apkanalyzer, which is also built into Android Studio.
So on every app made with flutter, the Flutter engine files/code will be inside the app, which causes an extra memory space, so when you run your app, this engine needs to run first ( which is really first ), then it will a wrapper over your Dart
code.
In order to know more about Flutter architecture and what happens under the hood, I recommend taking a look over this:
https://docs.flutter.dev/resources/faq