Home > database >  runtimeType of Lexical Closure
runtimeType of Lexical Closure

Time:01-29

Code:

void main(){
  print(foo().runtimeType);
}

Function foo(){
  return (){};
}

Output:

() => Null

Why is this Null and not void?

CodePudding user response:

From dart official site:

All functions return a value. If no return value is specified, the statement return null; is implicitly appended to the function body.

  •  Tags:  
  • Related