format method

String format(
  1. NavigationEvent event
)

Produces a single JSON line with consistently redacted route information.

Implementation

String format(NavigationEvent event) => jsonEncode({
      'sequence': event.sequence,
      'action': event.action.name,
      'from': _route(event.source),
      'to': _route(event.destination),
      if (event.route != null) 'route': _route(event.route),
      'stack': event.stack.map(_route).toList(),
      if (event.guardIndex != null) 'guardIndex': event.guardIndex,
      if (event.guardOutcome != null) 'guard': event.guardOutcome!.name,
      if (event.redirectLocation != null)
        'redirect': includeParameters ? event.redirectLocation : '[redacted]',
      if (event.failure case final failure?) ...{
        'errorType': failure.error.runtimeType.toString(),
        if (includeErrorDetails) ...{
          'error': _describe(failure.error),
          'stackTrace': _describe(failure.stackTrace),
        },
      },
    });