This is an immature article, because the scheme of this article may not be used, but still write out, for reference only.

The previous two articles analyzed Flutter Android/iOS product composition and size, and Flutter command line packaging, respectively:

  1. Flutter Android/iOS package Size analysis
  2. Package the Flutter command line

Because Flutter uses both the ARM64 and ARMV7 frameworks when the iOS release package is added, the size of Flutter will be significantly reduced if the arm64 Framework is added only. However, this can’t be done casually, depending on what instruction set your APP supports. If your APP only supports ARM64, it is best to reduce the Flutter package size by almost half. However, if your APP’s instruction set needs to support ARMV7 and ARM64, this solution is not suitable.

Let’s look at how iOS reduces packages.

Flutter iOS package reduction method

There are two ways to break up the Flutter Framework:

  1. Use the lipo command
$lipo .../Flutter/Flutter.framework/Flutter  -thin arm64 -output .../Flutter
Copy the code
  1. Using xcode_backend. Sh

First set the parameter, local ARCHS=”arm64″

Then run

$/bin/sh xcode_backen.sh thin
Copy the code

Running this script directly will cause an error, see the article Flutter command line package for details

conclusion

The size of Flutter iOS products containing both the ARMV7 and ARM64 instruction sets is 13.8m, but the size of Flutter iOS products containing only the ARM64 instruction sets is only 8M! 8M is pretty small for iOS.