With Dart 2.7 released this week, the Google-developed programming language adds extension methods, allowing developers to add functionality to any type—even to types not under the developer’s control.
Extension methods have the brevity and auto-complete experience of regular method calls. An example provided in a Google bulletin on the Dart 2.7 release illustrates how developers could extend the String class. Developers in the Dart community already have been experimenting with extension methods, including development of a time package using extensions on numcode, the base class for ints and doubles, for the construction of Duration objects.

