Null Safety - Nullable types
There are distinct advantages of the concept of null. But most times it's a double edged sword. In most languages that support null, has them implemented badly. Languages like C, C++, Java, C#, etc. have the problem of null reference exceptions (NRE) thrown when encountered null. In some languages like F# or Haskell, the problem of null is handled by option types. An option type has two forms, the type with a valid values or None. And the access to the value is gated, this way the compiler proves that there won't be NREs.
Dart handles this in much more user-friendly way. With null safety , All types become non nullable. That means no type can have a null. This eliminates the runtime NREs. But as we know, concept of null is valuable. Dart puts this in the hands of the coder. When we know that a variable can contain a null value their types are specifically marked. This lets the compiler verify the code to make sure the coder has taken all measures to eliminate an NRE.
Underneath Flutter there are cool language constructs providing you with the robustness and user-friendlyness.
#flutter #flutterdev #appdev