sanitizeRouteInformationState function
Returns state unchanged when its complete object graph is JSON-safe.
Navigation arguments remain available through PageSettings in memory. This only prevents opaque Dart objects (for example domain models), cyclic containers, maps with non-string keys, and non-finite numbers from reaching browser history serialization.
Implementation
@visibleForTesting
Object? sanitizeRouteInformationState(Object? state) {
return _isJsonSafeRouteInformationState(
state,
HashSet<Object>.identity(),
)
? state
: null;
}