What's the difference between
void test1(void fun(String element)) {
fun("Test1");
}
//AND
void test2(Function(String element) fun) {
fun("Test2");
}
I tried to run both of them and can't find any differences in the output:
void main() {
test1((test) => print(test));
test2((test) => print(test));
}
void test1(void fun(String element)) {
fun("Test1");
}
void test2(Function(String element) fun) {
fun("Test2");
}
// Output:
// Test1
// Test2
I'm new to Dart I've always been using Java, so passing function to a function is something new to me, so if someone can explain to me what's the differences in the above code would be very grateful.