Dart Gotchas!

Why

What

  • To allow an instance of Dart class to be called like a function (callable objects), implement the call() method. This method supports parameters and return type.
      class WannabeFunction {
          String call(String a, String b, String c) => '$a $b $c!';
      }
    
      var wf = WannabeFunction();
      var out = wf('Hi', 'there,', 'gang');
    

How

Where

When

Who

Written on June 23, 2024