Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn flutter

Flutter P3: Performance metrics

We develop one flutter app we need focus to 06 metric performance below: 1. Startup time to the first frame: Check the time when WidgetsBinding.instance.firstFrameRasterized is true. 2. Frame buildDuration , rasterDuration , and totalSpan 3. Statistics of frame buildDuration (*_frame_build_time_millis): monitoring four stats: average, 90th percentile, 99th percentile, and worst frame build time. 4. Statistics of frame rasterDuration (*_frame_build_time_millis):  monitoring four stats: average, 90th percentile, 99th percentile, and worst frame build time. 5. CPU/GPU usage 6. Release_size_bytes to approximately measure the size of a Flutter app

Flutter - P2: Improving rendering performance

1. Controlling build() cost:  - Repetitive and costly work in build() --> can be invoked frequently when ancestor Widgets rebuild.  It can be invoked frequently when ancestor Widgets rebuild. - Split them into different Widgets based on encapsulation, Avoid overly large single Widgets. Avoid calling setState () high up in the tree  2. Apply effects only when needed 3. Render grids and lists lazily 4. Build and display frames in 16ms for rendering on a 60Hz display. 60fps leads to a smooth visual experience. 5. Pitfalls - Avoid using the Opacity widget - Avoid putting a subtree in the builder function When using an AnimatedBuilder . - Avoid clipping in an animation. - Avoid using constructors with a concrete List of children (such as Column () or ListView ()) 6. Flutter’s threads - Platform thread : Plugin code runs here - UI thread : executes Dart code in the Dart VM (code that you wrote, and code executed by Flutter’s framework).Creates a layer tree sends to the raster thread to

Flutter P1: Understand about Flutter App size

1. App size of a debug build is large due to the debugging overhead that allows for hot reload and source-level debugging, not representative of a production app end users download. 2. Your upload package to the Play Store and App Store not representative of your end-users’ download size.  3. The stores generally reprocess upload package to target , such as filtering for assets targeting the phone’s DPI, filtering native libraries targeting the phone’s CPU architecture. 4. To analytic size we can use DEV tool or option " analyze-size " when export. example: flutter build apk --analyze-size flutter build ios --analyze-size 5. Reducing app size: use flag  -- split-debug-info tag. Optimize resource, asset.