I'm using GoRouter in my Flutter application to handle routing. However, when I navigate to a specific todo item, the screen freezes, but the log messages print correctly, indicating that the route transition is happening.
When I replace GoRouter with Navigator, everything works fine and the screen does not freeze.
I’ve defined the routes using GoRouter as follows:
static GoRoute _categoryTodosRoute() {
return GoRoute(
path: ':categoryId/todos',
builder: (context, state) {
final cid = state.pathParameters['categoryId']!;
return _categoryTodosRouteBuilder(cid);
},
routes: [
GoRoute(
path: 'todo/:todoId',
builder: (context, state) {
final tid = state.pathParameters['todoId']!;
log('${tid}');
return TodoView();
},
),
],
);
}
The 'categoryId/todos' is accessed correctly with no errors. The problem is with the below route, 'todo/:todoId'.
The navigation is done like that:
case _TodoMenuAction.view:
context.go('/categories/${categoryModel.id}/todos/todo/${todoModel.id}');
break;
The log message prints correctly, but the screen freezes and nothing updates visually.
However, when I replace GoRouter with the Navigator method like so:
case _TodoMenuAction.view:
Navigator.push(
context,
MaterialPageRoute(builder: (context) => TodoView()),
);
break;
The screen updates without issues.