title: Pass function as parameter in Dart
body: <p>Hello: I need pass a function (event handler) as parameter to other function site in other class:</p>
  
  <pre class="lang-dart prettyprint-override"><code>classB
  {
      ClassB(){}
  /***/
      load (void onData(Event e))
      {
          ImageElement ie=new ImageElement();
          ie.onLoad.listen( onData );  
          ie.src='hello.png';
      } 
  
  /***/
  
  }
  
  classA
  {
      List&lt;ClassB&gt; lcb=new List();
  
      ClassA(){}
    /****/
  
      void handler(Event e) {
          /****/
      }
  
      myFunction() { 
         /***/
          for (var i=0; i &lt; lcb.length; i++)
          {   
              ***
              lcb[i].load( handler );
              ***
          }
         /***/
      }
  }
  </code></pre>
  
  <p>It seems right in principle, but does not work. The function that is passed is never executed.
  Anyone have any idea what is the correct way?</p>