pop<T extends Object> method

Future<void> pop<T extends Object>([
  1. T? result
])

pop with arguments similar to Navigator.of(context).pop same as popUntil(uris.last)

若回到原生去,这里约定了只能传Map,若是对象的话 需要能够在 intent 中传递(TODO support)

Implementation

Future<void> pop<T extends Object>([T? result]) async {
  ///混合模式,从Native获取需要pop到的页面
  String target;
  if (multiple) {
    target = await NavigatorChannel.findPopTarget();
    print('find pop target in native $target');
  } else {
    ///从flutter获取即可
    target = findTargetInCurrentRoute();
    print('find pop target in flutter $target');
  }
  if (target == '') {
    /// not find target in native,it's not 'multiple' mode, find in Flutter
    if (_history.length <= 1) {
      return;
    }
    popUntil(_history[_history.length - 2].currentPage!.name, result);
  } else {
    ///find int native, it's 'multiple' mode
    popUntil(target, result);
  }
}