← All blogs

dust blog

Run Redirects Before Guards

Dust Routing Guards example showing router-level redirect before route-specific guards

Auth routing gets messy when every page handles access by itself.

Dust Routing Guards keep two checks separate. Use router-level redirect for global decisions, such as signed-out users. Use guards for route-specific decisions, such as admin access or cart readiness.

The router redirect runs first. If it returns another route, Dust evaluates that route instead of continuing guards for the original route.

Read the Dust Routing Guards guide.

#Dust #Routing #Flutter #Dart #CodeGeneration