I'm relatively new to Flutter. There seems to be huge amounts of people who are starting to work with Flutter and who have not heard of the concept of a null reference exception in Flutter or in other languages (you can call it a NullReferenceException
or a NullPointerException
or you can just crash and have users figure it out from the 0x00000000 address given in the dump, but the concept is always the same).
NoSuchMethod: the method 'XYZ' was called on null
There are plenty of questions that have this problem and most of them get answered, but each only for their own question. None of them is a good dupe target, because they specifically answer that question and explain what has to be changed in that code to make it work. It's hard to abstract it to a concept when your question gets closed as a duplicate of a question that seems to have absolutely nothing to do with yours.
So before I write one myself, my question is:
Did I miss a canonical post for this? Is there some Q&A I should be using as a dupe target?
(In case you think: wait, haven't I read this question before? Yes, it's very similar to Canonical Q/A for people that have problems with Future<T> in [flutter]). Similar Stack Overflow problem, different code problem.