router top-level property

GoRouter router
getter/setter pair

Implementation

GoRouter router = GoRouter(routes: [
  GoRoute(
    path: '/',
    builder: (context, state) => const PageListRole(),
  ),
  GoRoute(
    path: '/add',
    builder: (context, state) => PageAddRole(id: null),
  ),
  GoRoute(
    path: '/update/:id',
    builder: (context, state) => PageAddRole(id: state.pathParameters["id"] as String),
  ),
]);