GoRouter cung cấp GoRouterState với location, parameter, extra data: String id = state.pathParameters['id']!.
- Với nested navigation (bottom tab có stack độc lập), dùng
ShellRoute. - Với navigation dựa trên auth, dùng
redirect()để kiểm tra state auth trước khi build page:if (!isLoggedIn) return '/login'. - Điều này tập trung hóa logic navigation.
GoRouter provides GoRouterState with route location, parameters, and extra data.
- For nested navigation use
ShellRoute. - For auth-based navigation, use the
redirect()callback to check auth state before building pages, keeping all navigation logic centralized.