From 9d6b7c41e3f6251813df37d1a627a3d968d346a0 Mon Sep 17 00:00:00 2001 From: Kirill Nikolaev Date: Fri, 28 Sep 2018 00:48:29 +0200 Subject: [PATCH] Document that all MethodChannel callbacks must be called on the main thread. (flutter/engine#6245) This further addresses https://github.com/flutter/flutter/issues/14568. --- .../android/io/flutter/plugin/common/MethodChannel.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/MethodChannel.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/MethodChannel.java index ebfa421b71..991cf05e71 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/MethodChannel.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/common/MethodChannel.java @@ -117,6 +117,10 @@ public final class MethodChannel { *

Any uncaught exception thrown by this method will be caught by the channel implementation and * logged, and an error result will be sent back to Flutter.

* + *

The handler is called on the platform thread (Android main thread). For more details see + * Threading in the Flutter + * Engine.

+ * * @param call A {@link MethodCall}. * @param result A {@link Result} used for submitting the result of the call. */ @@ -128,6 +132,10 @@ public final class MethodChannel { * to be invoked by Flutter act as clients of this interface for sending results * back to Flutter. Invokers of Flutter methods provide implementations of this * interface for handling results received from Flutter. + * + *

All methods of this class must be called on the platform thread (Android main thread). For more details see + * Threading in the Flutter + * Engine.

*/ public interface Result { /**