Cannot omit 'new' keyword despite using Dart 2.0


When i run the tests of my application i get this exception:

NoSuchMethodError: Attempted to use type 'SimplePipe' as a function. Since types do not define a method 'call', this is not possible. Did you intend to call the SimplePipe constructor and forget the 'new' operator?

I conclude from this error message that my project is actually not using Dart 2.0 but Dart 1.0.
The sdk is set to >=2.0.0-dev.53.0 <2.0.0 in pubspec.yaml, though.

A friend of mine is getting this this error message when running the same tests under the same conditions on his PC. He already tried running pub get.

Dart 2.0.0-dev.54.0.flutter-46ab040e58 is incompatible with your dependencies' SDK constraints. Please run "pub get" again


name: timecoder_common
description: A Dart Libary containin all the shared logic
version: 0.0.1

  sdk: '>=2.0.0-dev.53.0 <2.0.0'

  uuid: "^0.5.3"
  json_annotation: "^0.2.3"
  http: "^0.11.3"
  rxdart: "^0.16.6"
  test: "^0.12.34"

  build_runner: "^0.8.0"
  json_serializable: "^0.5.0"


The Dart 2.0 SDK does not enable this by default (yet).

For Flutter, you will need to be on the latest SDK:

In this blog post, we’ll take a deeper look at the specific improvements we’ve made in Beta 3 itself.

For the command-line VM, as mentioned in the comments, you must opt-in:

dart --preview-dart-2 bin/main.dart

Answered By – matanlurey

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.