diff --git a/shell/platform/android/io/flutter/plugin/common/MethodCall.java b/shell/platform/android/io/flutter/plugin/common/MethodCall.java index b30ac2eef319a..6864e42a4643c 100644 --- a/shell/platform/android/io/flutter/plugin/common/MethodCall.java +++ b/shell/platform/android/io/flutter/plugin/common/MethodCall.java @@ -4,6 +4,7 @@ package io.flutter.plugin.common; +import android.support.annotation.Nullable; import java.util.Map; import org.json.JSONObject; @@ -61,6 +62,7 @@ public T arguments() { * {@link JSONObject}. */ @SuppressWarnings("unchecked") + @Nullable public T argument(String key) { if (arguments == null) { return null; diff --git a/shell/platform/android/io/flutter/plugin/common/MethodChannel.java b/shell/platform/android/io/flutter/plugin/common/MethodChannel.java index 991cf05e7129c..b05c38027e836 100644 --- a/shell/platform/android/io/flutter/plugin/common/MethodChannel.java +++ b/shell/platform/android/io/flutter/plugin/common/MethodChannel.java @@ -4,6 +4,7 @@ package io.flutter.plugin.common; +import android.support.annotation.Nullable; import android.util.Log; import io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler; import io.flutter.plugin.common.BinaryMessenger.BinaryReply; @@ -65,7 +66,7 @@ public MethodChannel(BinaryMessenger messenger, String name, MethodCodec codec) * @param method the name String of the method. * @param arguments the arguments for the invocation, possibly null. */ - public void invokeMethod(String method, Object arguments) { + public void invokeMethod(String method, @Nullable Object arguments) { invokeMethod(method, arguments, null); } @@ -78,7 +79,7 @@ public void invokeMethod(String method, Object arguments) { * @param arguments the arguments for the invocation, possibly null. * @param callback a {@link Result} callback for the invocation result, or null. */ - public void invokeMethod(String method, Object arguments, Result callback) { + public void invokeMethod(String method, @Nullable Object arguments, Result callback) { messenger.send(name, codec.encodeMethodCall(new MethodCall(method, arguments)), callback == null ? null : new IncomingResultHandler(callback)); } @@ -97,7 +98,7 @@ public void invokeMethod(String method, Object arguments, Result callback) { * * @param handler a {@link MethodCallHandler}, or null to deregister. */ - public void setMethodCallHandler(final MethodCallHandler handler) { + public void setMethodCallHandler(final @Nullable MethodCallHandler handler) { messenger.setMessageHandler(name, handler == null ? null : new IncomingMethodCallHandler(handler)); } @@ -143,7 +144,7 @@ public interface Result { * * @param result The result, possibly null. */ - void success(Object result); + void success(@Nullable Object result); /** * Handles an error result. @@ -152,7 +153,7 @@ public interface Result { * @param errorMessage A human-readable error message String, possibly null. * @param errorDetails Error details, possibly null */ - void error(String errorCode, String errorMessage, Object errorDetails); + void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails); /** * Handles a call to an unimplemented method.