Flutter failed assertion (home ==Null!)

when I tried to execute the attached program. I get the above error message. I am still learning, please advise what to do.

Hello and welcome!

In the red box you may read the reason for the error in your code.

If the home property is specified, the routes table cannot include an entry for “/”, since it would be redundant.

Let me remind you a golden rule of programming: never, ever, skip reading the error messages.
Someone has put that string in the compiler, to be human friendly.
Understanding the complains of compilers/interpreters is a fundamental skill you’ll have to learn to be effective in this job (and the only way I know is by doing many mistakes).

When you find yourself staring at code or errors and you are not actually reading them, shut that voice in your brain dumbly repeating “its not possible” and focus on those written words instead. Most of the time the solution is just in front of you!

For that reason, snapshots and copy&paste are not always your friends.

An excellent debugging technique is one of the best Joe Armstrong’s legacy (just second to Erlang):

“When you can’t figure it out, ask the duck!”

When you cannot figure out what’s wrong in your code, do explain it to your favourite rubber duck. In the rare occasions that it fail, Joe suggested an even stronger debugging protocol:

Hth

Thank you ! It worked and I will keep your advise in mind.

1 Like