Issue
What is difference between Function and Function() in Dart/Flutter? for example in such a code final Function x; final Function() x;
Solution
As stated in the Function documentation, it is:
The base class for all function types.
A variable declared with type Function therefore can be assigned any function. However, you won't get any type-safety when invoking it.
Meanwhile a Function() type is a function with an unspecified (i.e., dynamic) return type and that takes zero arguments.
Answered By - jamesdlin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.