redirect method

void redirect(
  1. String path, {
  2. VoidCallback? onComplete,
})

Meant to be used from with onBeforeUpdate inside of StackRouteBuilder, Changes path in the next frame to avoid errors when building mid-build.

Implementation

void redirect(String path, {VoidCallback? onComplete}) async => scheduleMicrotask(() {
      this.path = path;
      onComplete?.call();
    });