doc/api/boost_navigator/BoostNavigator/push.html
Future<T>push<T extends Object>(
)
Push the page with the given name onto the hybrid stack. arguments is the param you want to pass in next page if withContainer is true,next route will be with a native container (Android Activity / iOS UIViewController) if opaque is true,the page is opaque (not transparent)
And it will return the result popped by page as a Future
Future<T> push<T extends Object>(String name,
{Map<String, dynamic> arguments,
bool withContainer = false,
bool opaque = true}) async {
var pushOption =
BoostInterceptorOption(name, arguments ?? <String, dynamic>{});
var future = Future<dynamic>(
() => InterceptorState<BoostInterceptorOption>(pushOption));
for (var interceptor in appState.interceptors) {
future = future.then<dynamic>((dynamic _state) {
final state = _state as InterceptorState<dynamic>;
if (state.type == InterceptorResultType.next) {
final pushHandler = PushInterceptorHandler();
interceptor.onPush(state.data, pushHandler);
return pushHandler.future;
} else {
return state;
}
});
}
return future.then((dynamic _state) {
final state = _state as InterceptorState<dynamic>;
if (state.data is BoostInterceptorOption) {
assert(state.type == InterceptorResultType.next);
pushOption = state.data;
if (isFlutterPage(pushOption.name)) {
return appState.pushWithResult(pushOption.name,
arguments: pushOption.arguments,
withContainer: withContainer,
opaque: opaque);
} else {
final params = CommonParams()
..pageName = pushOption.name
..arguments = pushOption.arguments;
appState.nativeRouterApi.pushNativeRoute(params);
return appState.pendNativeResult(pushOption.name);
}
} else {
assert(state.type == InterceptorResultType.resolve);
return Future<T>.value(state.data as T);
}
});
}