-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#30697Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: performanceRelates to speed or footprint issues (see "perf:" labels)Relates to speed or footprint issues (see "perf:" labels)c: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: money (g3)engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.
Description
Implement a way for Platform Channels to execute their host platform handlers on a background thread instead of forcing them to use the platform thread.
Example usage:
public class PluginCodelabPlugin implements FlutterPlugin, MethodCallHandler {
private MethodChannel methodChannel;
private BasicMessageChannel<Object> basicChannel;
private static void setup(PluginCodelabPlugin plugin,
BinaryMessenger binaryMessenger) {
// This is a new call to create the TaskQueue.
BinaryMessenger.TaskQueue taskQueue = binaryMessenger.makeTaskQueue();
// The 3rd parameter is new.
plugin.methodChannel = new MethodChannel(binaryMessenger, "method", taskQueue);
plugin.methodChannel.setMethodCallHandler(plugin);
// The 4th parameter is new.
plugin.basicChannel =
new BasicMessageChannel<>(binaryMessenger,
"basic",
StandardMessageCodec.INSTANCE,
taskQueue);
plugin.basicChannel.setMessageHandler((message, reply) -> reply.reply(null));
}
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
setup(this, flutterPluginBinding.getBinaryMessenger());
}
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
result.notImplemented();
}
}mono0926
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: performanceRelates to speed or footprint issues (see "perf:" labels)Relates to speed or footprint issues (see "perf:" labels)c: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: money (g3)engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.