void clearAndNavigate(String path) { while (context.canPop() == true) { context.pop(); } context.pushReplacement(path); }
이번 프로젝트에서 제일 화나게하는 친구였지만.. 드디어 해결했다
알고보니 다트/플러터에는 현재 스택을 완전히 비우고 새로운 스택에 이 페이지를 추가하는 메서드가 없기 때문에 다들 꼼수(?)같은 이 방법을 사용한다고 한다.
https://stackoverflow.com/questions/74065226/how-to-clear-go-router-navigation-history-in-redirect-method