5package io.flutter.embedding.engine.systemchannels;
7import androidx.annotation.NonNull;
8import androidx.annotation.Nullable;
10import io.flutter.embedding.engine.dart.DartExecutor;
11import io.flutter.plugin.common.JSONMethodCodec;
12import io.flutter.plugin.common.MethodCall;
13import io.flutter.plugin.common.MethodChannel;
14import java.util.HashMap;
19 private static final String TAG =
"NavigationChannel";
21 @NonNull
public final MethodChannel
channel;
24 this.channel =
new MethodChannel(dartExecutor,
"flutter/navigation", JSONMethodCodec.INSTANCE);
25 channel.setMethodCallHandler(defaultHandler);
30 private final MethodChannel.MethodCallHandler defaultHandler =
31 new MethodChannel.MethodCallHandler() {
33 public void onMethodCall(@NonNull
MethodCall call, @NonNull MethodChannel.Result
result) {
39 Log.
v(
TAG,
"Sending message to set initial route to '" + initialRoute +
"'");
40 channel.invokeMethod(
"setInitialRoute", initialRoute);
44 Log.
v(
TAG,
"Sending message to push route '" + route +
"'");
45 channel.invokeMethod(
"pushRoute", route);
49 Log.
v(
TAG,
"Sending message to push route information '" + route +
"'");
50 Map<String, String>
message =
new HashMap<>();
56 Log.
v(
TAG,
"Sending message to pop route.");
57 channel.invokeMethod(
"popRoute",
null);
61 channel.setMethodCallHandler(handler);
static void v(@NonNull String tag, @NonNull String message)
void setMethodCallHandler(@Nullable MethodChannel.MethodCallHandler handler)
void pushRoute(@NonNull String route)
final MethodChannel channel
void pushRouteInformation(@NonNull String route)
NavigationChannel(@NonNull DartExecutor dartExecutor)
void setInitialRoute(@NonNull String initialRoute)