GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Dart
  • Docs
  • Overview
  • Blog
  • Community
  • Learn
  • Get Dart
  • search
  • DartAPI
  • DartPad
  • pub.dev
  • Language
  • Callable objects
  • docsView source

This view

  • Original page
  • New address

GeezerVison is showing dart.dev — Callable objects

Dart 3.14 brings your workflow full circle with automated SDK migrations (dart migrate), a re-engineered DartPad, and faster WebAssembly. Learn more

To allow an instance of your Dart class to be called like a function, implement the call() method.

The call() method allows an instance of any class that defines it to emulate a function. This method supports the same functionality as normal functions such as parameters and return types.

In the following example, the WannabeFunction class defines a call() function that takes three strings and concatenates them, separating each with a space, and appending an exclamation. Click Run to execute the code.

class WannabeFunction {
  String call(String a, String b, String c) => '$a $b $c!';
}

var wf = WannabeFunction();
var out = wf('Hi', 'there,', 'gang');

void main() => print(out);
Was this page's content helpful?

Unless stated otherwise, the documentation on this site reflects Dart 3.14.0. Page last updated on 2025-10-18. View source or report an issue.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.