renderRouteChange function

void renderRouteChange(
  1. LiveBlock block,
  2. String path,
  3. Map<String, Object?> payload
)

Adds the outcome of a route.push to path to block.

Implementation

void renderRouteChange(
  LiveBlock block,
  String path,
  Map<String, Object?> payload,
) {
  final Object? from = payload['from'];
  final Object? current = payload['current'];
  if (payload['changed'] == false) {
    block.note(
      'Stayed on ${current ?? from ?? 'the current page'}. A route guard may '
      'have stopped the navigation to $path.',
    );
    return;
  }
  final String redirected = current != null && current != path
      ? ' (redirected from $path)'
      : '';
  block.success('${from ?? '-'} → ${current ?? path}$redirected');
}