args property

Map<String, dynamic>? get args

Retrieves the arguments passed to the current route.

Returns a Map of arguments or and empty map if no arguments were passed.

Implementation

Map<String, dynamic>? get args {
  final navigatorState = this.currentState;
  if (navigatorState == null) return null;
  final observer = navigatorState.widget.observers.firstWhere(
    (observer) => observer is GoNavigatorObserver,
    orElse: () => GoNavigatorObserver(),
  ) as GoNavigatorObserver;

  if (observer.topRoute == null) return null;
  return observer.topRoute!.settings.arguments as Map<String, dynamic>?;
}