2

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

pubspec.yaml:

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

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

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

dev_dependencies:
  build_runner: "^0.8.0"
  json_serializable: "^0.5.0"
Rémi Rousselet
  • 256,336
  • 79
  • 519
  • 432
Tobias Marschall
  • 2,355
  • 3
  • 22
  • 40
  • How are you attempting to run it? If it's through the VM you likely need `--preview-dart-2`. If you're using `pub run` it should be `DART_VM_OPTIONS=--preview-dart-2 pub run test` – Nate Bosch May 24 '18 at 00:00

1 Answers1

1

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
matanlurey
  • 8,096
  • 3
  • 38
  • 46