16

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).

/ would say:

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.

8
  • 1
    What could you say? 'You tried to call a method through a null object pointer/reference'? Sep 18, 2020 at 20:40
  • 6
    Languages like Java and C# have canonicals for NullPointerException/NullReferenceException -- it makes sense that flutter have one too but (like the OP) I'm not familiar enough the body of work for the language on this site to know which is the preferred dupe target. Generally those questions tell you what the question is and also how to identify where it's happening and how to remedy it. Sep 18, 2020 at 20:47
  • 1
    A null reference is, in most cases,, one of the easiest bugs to detect and isolate with a debugger, even with languages with no heavy runtime and just segfault/AV. My conclusion is that many developers are trying to use an OO language with no basic understanding of OO and debugging. SO is not a good place to ask for tuition in basic foundations:( Sep 19, 2020 at 10:33
  • 3
    @MartinJames There are literally thousands of votes disagreeing with your last sentence. See this canonical for another language: stackoverflow.com/questions/4660142/…
    – nvoigt
    Sep 19, 2020 at 11:56
  • 1
    @nvoigt there may well be, just as there are thousands of users who want other SO users to do all of their homework for them. Luckily, my involvement is voluntary, and so I cannot be pushed into work that I am not qualified, or paid, to do, such as 'Computers 101' teacher. Sep 19, 2020 at 18:18
  • 5
    I never asked anyone to do any work. I just asked if I missed something, before I do the work.
    – nvoigt
    Sep 20, 2020 at 10:43
  • 6
    @MartinJames SO needs to be able to deal effectively with people who lack basic knowledge. With so many people picking up programming every day, and starting at the beginning. With the wealth of learning resources available, we cannot expect everybody to have gotten the same thorough grounding. Given the options of repeated brief explanations, closing in favour of a canonical question, and sending the people away, I prefer the canonical question. Getting your basics from a FAQ is actually not bad, sometimes. E.g isocpp.org/faq is pretty good intro, for some.
    – user7610
    Sep 20, 2020 at 12:58
  • 1
    Not sure if it make sense to spoon them, because there's plenty of resources available online. The fundamental problem rather is convenience... because asking is easier then searching and being tutored is easier than trial and error. Just because it's Flutter and not Java, does not really make a big difference with these exceptions, because the reason is just the same. Sep 20, 2020 at 13:17

1 Answer 1

4

As it seems there was none before, I wrote one:

What is a NoSuchMethod error and how do I fix it?

Feel free to add or improve where necessary. As said, I'm new to .

2
  • Does someone need to approve this as dup target? Cause I'm afraid to be banned/suspended, for using it. Anyway decision has to be made, because flutter tag is flooded with such questions Dec 25, 2020 at 13:07
  • 2
    Nobody needs to approve it, you can vote as duplicate whenever you think something is a duplicate.
    – nvoigt
    Dec 25, 2020 at 13:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .