title: Function as an argument in another function - Dart
body: <p>What's the difference between </p>
  
  <pre><code>void test1(void fun(String element)) {
    fun("Test1");
  }
  
  //AND
  
  void test2(Function(String element) fun) {
    fun("Test2");
  }
  </code></pre>
  
  <p>I tried to run both of them and can't find any differences in the output:</p>
  
  <pre><code>void main() {
    test1((test) =&gt; print(test));
    test2((test) =&gt; print(test));
  }
  
  void test1(void fun(String element)) {
    fun("Test1");
  }
  
  void test2(Function(String element) fun) {
    fun("Test2");
  }
  
  // Output:  
  // Test1   
  // Test2
  </code></pre>
  
  <p>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.</p>