Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5140e30

Browse files
Provide a default handler for the flutter/navigation channel (#29511)
1 parent 32fff2f commit 5140e30

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

shell/platform/android/io/flutter/embedding/engine/systemchannels/NavigationChannel.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.flutter.Log;
1010
import io.flutter.embedding.engine.dart.DartExecutor;
1111
import io.flutter.plugin.common.JSONMethodCodec;
12+
import io.flutter.plugin.common.MethodCall;
1213
import io.flutter.plugin.common.MethodChannel;
1314

1415
/** TODO(mattcarroll): fill in javadoc for NavigationChannel. */
@@ -19,8 +20,19 @@ public class NavigationChannel {
1920

2021
public NavigationChannel(@NonNull DartExecutor dartExecutor) {
2122
this.channel = new MethodChannel(dartExecutor, "flutter/navigation", JSONMethodCodec.INSTANCE);
23+
channel.setMethodCallHandler(defaultHandler);
2224
}
2325

26+
// Provide a default handler that returns an empty response to any messages
27+
// on this channel.
28+
private final MethodChannel.MethodCallHandler defaultHandler =
29+
new MethodChannel.MethodCallHandler() {
30+
@Override
31+
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
32+
result.success(null);
33+
}
34+
};
35+
2436
public void setInitialRoute(@NonNull String initialRoute) {
2537
Log.v(TAG, "Sending message to set initial route to '" + initialRoute + "'");
2638
channel.invokeMethod("setInitialRoute", initialRoute);

0 commit comments

Comments
 (0)