The little details of Flutter development

Small attention to creating applications with Flutter

Package names

Whenever you create a new Flutter application, some Flutter IDE plugins will ask you to enter a package name like com.example, and the package name (called Bundle ID in iOS) is usually the reverse of the company domain name . If your app is going to be put on the store, it is recommended to set the unique package name of the whole network at the beginning, because it cannot be modified after the app is put on the shelf .

Attention should be paid to running Flutter App on Vscode

project naming

Do not use uppercase letters, otherwise an error will be reported as followserror using capitalization

simulator

You cannot start the iOS Simulator on Windows or Linux

Hot reload function:

The hot reload feature only works in debug mode;

Emulators and simulators can only be run in debug mode;

In the debugging mode, the performance of the application may drop frames or freeze, but in the profile mode, it will be closer to the performance of the real machine

Debug mode under the web platform means:

This build does not minimize resources and the entire build does not optimize performance.

To simplify debugging, this web application uses the dartdevc compiler.

Run in Release mode

Release mode on the web platform means:

This time build resources have been compressed and performance optimized.

This web application is built with the dart2js compiler to ensure better performance .

flutter help build Check the supported compilation methods as follows
supported methods

run in profile mode

Do not do performance testing with debug mode and hot reload enabled.
flutter run --profile Enable
Profile mode on the web platform means:

Resource files are not compressed, but overall performance has been optimized.

This web application is built with the dart2js compiler.

DevTools cannot connect to Flutter web apps running in performance mode. You need to use Chrome's DevTools to generate timeline events for web applications.

Ways to reduce app size

Consider using the --split-debug-info flag when building a release version of your application. This tag will significantly reduce the amount of code.
Other ways to reduce app size:

  • delete unused resources
  • Minimize resources brought in from libraries
  • Compress PNG and JPEG files

Guess you like

Origin blog.csdn.net/zww986736788/article/details/130539115