3
"Non-nullable instance field '_Description' must be initialized."
As of version 2.12.0, Flutter always displays messages like this, how to solve this problem without downloading the version?
Researching, I saw that could put the "?" next to the guy:
String? _Description;
But I don’t really understand what it does and at the same time it generates other mistakes in my project
Briefly, such as declaring null objects on Dart without being required to pass value.
When you put the
?
, you are saying that this object can be null, therefore, to access it in another part of the code, you need to verify whether that object is null or not. Surely, these other errors you are seeing are why, you are trying to access an object that can be null without any verification. You can solve quickly by putting!
in front of the object, for example:print(_Descricao!.toLowerCase())
... if _Description is null, will give error. For n give error, you can use the??
, thus:print(_Descricao ?? 'descricao nula!')
– Kiritonito
The error in the title,
_description
nay is marked as null, meaning you has that initialize it, because it will never be null. They should not have closed their question... stack br closes the question and.e.– Kiritonito