goBack<T> method

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

Goes back to the previous route

Implementation

void goBack<T>([T? result]) {
  if (navigator == null) {
    throw StateError('Navigator not initialized');
  }

  if (navigator!.canPop()) {
    navigator!.pop<T>(result);
  } else {
    if (enableDebugMode) {
      debugPrint('NavigationService: Cannot go back - no routes to pop');
    }
  }
}