In my case, i accidently used pushNamed instead of push. To use pushName name should be defined in go router otherwise it will throw this error.
pushNamed
push