DART 2.6 2019-11-05

DART 2.6 2019-11-05 :

Static extension members (extension)

  • Dart 2.6 version is the ‘static extension methods preview’.
  • Declared static functions to be invoked like instance members on expressions of appropriate static types
  • Can create new methods for existing classes. Meaning, in place of writing a function which takes an instance of a class, developers will now be able to declare “extension” for any class that would contain their additional methods.
DART 2.6 2019-11-05
extension IntDoubler on int {
  int doubleMe() => this * 2;

void main() {
  for (int i = 0; i < 10; i++) {
    print('$i becomes ${i.doubleMe()}');

output :

0 * 0
1 * 2
2 * 4
3 * 6
4 * 8
5 * 10
6 * 12
7 * 14
8 * 16
9 * 18

Concat using extension

extension on String{
  String concat (String c) => this + c;

  String name = 'Flutter Developer ';


Check Email using extension

extension StringExtensions on String {
  bool get isValidEmail {
    final emailRegExp = RegExp(r"^[a-zA-Z0-9.]+@[a-zA-Z0-9]+\.[a-zA-Z]+");
    return emailRegExp.hasMatch(this);

main() {
  bool isCheck = 'someString'.isValidEmail;
  print("Check the email " + isCheck.toString());


Inference is changed when using Null values in a FutureOr context. Namely, constraints of the forms similar to Null <: FutureOr now yield Null as the solution for T.

import 'dart:async';

void foo<T>(FutureOr<T> Function() f) {

main() {
  foo(() {});

Core libraries

Default values of parameters of abstract methods are no longer available via dart:mirrors.


Added optional parent parameter to TimelineTask constructor to allow for linking of asynchronous timeline events in the DevTools timeline view.

Dart VM

Added a new tool for AOT compiling Dart programs to native, self-contained executables.

Foreign Function Interface

  • Breaking change: The API now makes use of static extension members. Static extension members enable the dart:ffi API to be more precise with types, and provide convenient access to memory through extension getters and setters. The extension members on Pointer provide .value and .value = for accessing the value in native memory and [] and []= for – indexed access. The method asExternalTypedData has been replaced with asTypedList extension methods. And finally, Structs do no longer have a type argument and are accessed using the extension member .ref on Pointer. These changes makes the code using dart:ffi much more concise.
  • Breaking change: The memory management has been removed (Pointer.allocate and Pointer.free). Instead, memory management is available in package:ffi.
    Breaking change: Pointer.offsetBy was removed, use cast and elementAt instead.
  • Faster memory load and stores.
  • The dartanalyzer (commandline and IDEs) now reports dart:ffi static errors.
  • Callbacks are now supported in AOT (ahead-of-time) compiled code.

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit www.fluttertutorial.in