Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn Navigation

go_router and deep links: the parts the quickstart leaves out

Every routing tutorial ends at the same place: a GoRouter with three routes, a context.go('/details/42') , and a screenshot of it working. That part takes ten minutes. The parts that take the rest of the week are the ones nobody demos — an auth redirect that does not fight the login screen, a bottom navigation bar where each tab keeps its own history, and the platform configuration that decides whether https://yourapp.com/order/7 opens your app or Safari. The routing table, and where state actually lives Start with the shape that scales, which is a top-level router object that is not rebuilt: final _rootKey = GlobalKey < NavigatorState >(); final _shellKey = GlobalKey < NavigatorState >(); final router = GoRouter ( navigatorKey : _rootKey, initialLocation : '/feed' , debugLogDiagnostics : true , routes : [ /* ... */ ], errorBuilder : (context, state) => NotFoundScreen (uri : state.uri), ); class App extends Stat...