Repository: flutter
Issue: Reducing Flutter APK Size
Labels: c: new feature,platform-android,engine,a: size,c: proposal,P3,team-android,triaged-android

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Use case

Large APK Size

### Proposal

Subject: **Proposal for Reducing Flutter APK Size by Externalizing Dart and Flutter Engine**

_Dear Google Flutter Team,_

I hope this message finds you well. I am writing to propose a solution to address the ongoing challenge of large APK sizes in Flutter applications. As you are aware, one of the primary contributors to this issue is the inclusion of the Dart framework and Flutter engine within each Flutter APK. This results in significant bloat and limits the user experience, especially in regions with limited bandwidth and storage capacity.

To mitigate this problem and enhance the efficiency of Flutter apps, I suggest externalizing the Dart framework and Flutter engine by developing an Android Native app dedicated to running these components. This dedicated "Flutter Engine App" would serve as a central repository for the engine and runtime files, which can be updated independently of individual Flutter apps.

Here's how the proposed solution would work:

Separate Flutter Engine App: Develop a standalone Android Native app specifically designed to house the Dart framework and Flutter engine components. This app would be responsible for maintaining and updating these core elements.

Dynamic Linking: Modify the Flutter framework in a way that allows Flutter apps to dynamically link to the Flutter Engine App when necessary. This means that individual Flutter apps would no longer need to bundle the Dart and Flutter engine, reducing their APK size significantly.

Version Compatibility: Ensure that the Flutter Engine App is always compatible with the latest Flutter SDK. This way, when developers update their Flutter SDK, the Flutter Engine App can also be updated accordingly to support the latest features and optimizations.

Opt-in Mechanism: Allow developers to opt-in to this externalization feature within their Flutter projects. While it could be the default behavior, providing an option for developers to bundle the engine locally for specific use cases would offer flexibility.

Documentation and Migration Support: Provide comprehensive documentation and migration guides to assist Flutter developers in transitioning to this new architecture. Offer tools and scripts to facilitate the migration process.

By implementing this solution, Flutter app developers would benefit in several ways:

Reduced APK Size: Smaller APK sizes would lead to faster downloads, improved user retention, and a better overall user experience, especially in regions with limited network connectivity.

Efficient Updates: Updates to the Flutter engine and runtime could be pushed independently through the Flutter Engine App, ensuring that Flutter apps always run on the latest and most optimized version of the framework.

Streamlined Development: Developers can focus on building app-specific features rather than worrying about bundling and managing the Flutter engine components.

I believe that externalizing the Dart framework and Flutter engine into a dedicated Android Native app is a step in the right direction for Flutter's future development. It addresses a critical pain point for developers and end-users alike.

I would be delighted to discuss this proposal further and provide any assistance needed to explore its feasibility and implementation. Flutter's growth has been remarkable, and I am confident that this solution can contribute to its continued success.

Thank you for your time and consideration. I look forward to hearing your thoughts and collaborating to make Flutter even more efficient and accessible to developers worldwide.

Best regards,

Richard Appow
richappow@gmail.com