back<T> method

Future<void> back<T>([
  1. T? result
])

Implementation

Future<void> back<T>([T? result]) async {
  if (canGoBack.value) {
    navigatorKey.currentState?.pop(result);
    _historyIndex =
        (_historyIndex - 1).clamp(0, navigationHistory.val.length - 1);
    final entry = navigationHistory.val.isNotEmpty
        ? navigationHistory.val[_historyIndex]
        : null;
    if (entry != null) {
      currentRoute.emit(entry.state);
    }
  }
}