Google Dart adds extension methods

Google Dart adds extension methods


Google Dart adds extension methods | InfoWorld

using extensions on numcode, the base class for ints and doubles, for the construction of Duration objects.

Extension methods can work with Dart’s . Because extension methods are dispatched dynamically, they cannot be called on values whose type is dynamic. Extension methods are resolved statically, meaning they are as quick as calling a helper method or static function but with a friendlier invocation syntax. Also, extension methods can have type variables and are actually extension members.

Dart 2.7 can be accessed from or in the tool release. Other capabilities in Dart 2.7 include:

  • A package, supporting strings viewed as user-perceived characters, also known as . The package is available as a technical preview.
  • A null safety static analysis preview. Dart builders previously had announced intent to support null safety, adding support for safely accessing object references without triggering null reference exceptions.

, Dart now is positioned as a client-optimized language for building apps on any platform. Dart is billed as being easy to learn for developers who already program in Java, JavaScript, or Swift.