Mobile Development 9 min read

Flutter Bridge Calls, Async Concurrency, FPS Metrics, and Impeller Engine Overview

The article explains how to correctly handle MethodChannel bridge calls, avoid async/await concurrency pitfalls, interpret FPS metrics beyond raw frame rates, and get started with Flutter’s new Impeller rendering engine, highlighting its setup, benefits, and current limitations.

Xianyu Technology
Xianyu Technology
Xianyu Technology
Flutter Bridge Calls, Async Concurrency, FPS Metrics, and Impeller Engine Overview

This article covers several key topics in Flutter development: proper handling of MethodChannel bridge calls, pitfalls of async/await concurrency, interpreting FPS metrics, and an introduction to the new Impeller rendering engine.

Flutter Bridge Calls – Pay Attention to Result Feedback

Using a MethodChannel to extend Flutter functionality is common (e.g., network requests, local storage, page communication). If the return value is not handled correctly, the Dart side may wait indefinitely.

void getResult() async {
dynamic result = await MethodChannel('methodChannelName')
.invokeMethod<dynamic>('methodName', {'params': content});
doOtherJobs();
}

Corresponding Android native implementation:

@Override
public void onMethodCall(MethodCall call, Result result) {
switch (call.method) {
case "methodName": {
doJob();
break;
}
}
}

If the native side does not signal completion, the Dart await will block forever. The native code must call one of:

result.success();
result.error();
result.notImplemented();

Neglecting this can cause hidden bugs.

Potential Concurrency Issues with Flutter await

In Dart, an async function returns a Future . Code after the await runs only after the awaited Future completes. However, other asynchronous tasks may run in the meantime, potentially changing shared state.

bool needReturn = false;
Future
doJob2() async {
needReturn = true;
}
Future
doJob() async {
if (needReturn) {
return;
}
print('needReturn position1 is $needReturn');
await doSomething();
print('needReturn position2 is $needReturn');
}
Future
doSomething() async {
print('doSomething~~~');
}

Answers:

At position1 , needReturn is always false because doJob2 has not run yet.

At position2 , needReturn may be true if doJob2 was triggered by another concurrent flow while awaiting doSomething . Therefore, always re‑check shared variables after await .

Flutter FPS Does Not Guarantee Smoothness

FPS (Frames Per Second) measures how many frames are rendered each second, but a high FPS does not always mean a fluid experience. Sudden drops in frame time cause noticeable jank even if the average FPS looks acceptable.

To detect frame‑level performance issues, use:

WidgetsBinding.instance.addTimingsCallback();

The callback provides a FrameTiming object with timestamps for vsync, build, and raster phases, enabling fine‑grained analysis.

Two practical heuristics for identifying a stall:

Current frame time exceeds M times the average of the previous N frames (e.g., 3 frames, 2× multiplier).

Frame time surpasses the movie‑frame threshold (~41.7 ms for 24 fps).

Trying Out Flutter’s New Rendering Engine Impeller

Impeller is an early‑onset jank mitigation effort, acting as a Skia alternative. It became publicly available in Flutter 3.0 (preview) and was refined in Flutter 3.3.

Enable Impeller:

Run with flutter run --enable-impeller .

Add platform‑specific configuration.

iOS (Info.plist):

<key>FLTEnableImpeller</key>
<true/>

Android (AndroidManifest.xml):

<meta-data
android:name="io.flutter.embedding.android.EnableImpeller"
android:value="true" />

Preliminary tests show:

Significant improvement in the official Gallery demo; the debug build with Impeller matches the performance of the previous release build.

In complex real‑world apps (e.g., Xianyu), Impeller does not yet outperform Skia and may exhibit rendering errors.

Overall, Impeller is a promising step toward eliminating jank, though it remains immature for production use.

FlutterperformanceAsyncImpellerMethodChannel
Xianyu Technology
Written by

Xianyu Technology

Official account of the Xianyu technology team

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.