What is the default return value of a Dart function?
I would like to quote two important note here. It might help others:
Though Dart is Optionally typed ( meaning, specifying the return type of a function such as int or void is optional ), it always recommended to specify type wherever possible. In your code, as a sign of good programming practice, do mention the return type.
If your function does not return a value then specify void. If you omit the return type then it will by default return
null
.All functions return a value. If no return value is specified, the statement return
null
; is implicitly appended to the function body.