Dart allows to return null;
from a function or a method with void
return type. That happens because, from a technical
standpoint, unlike other languages like Java, every function in Dart returns a value: if you don’t return a value, null
will be
returned.
From a semantical standpoint, however, this can be misleading, as it may suggest that the function does return an intended value, which is not the
case.
It is better to consistently use return;
and make it clear that in fact the function does not return any intended value.