Friday, 27 July 2018

Flutter fails on `flutter` command : Invalid version constraint

Image Source: Wikipedia

As you have started to learning flutter and you have tried to install their dependencies from flutter official document.

And when you tried to install it and if you get the following error. you can fix it easily.

flutter init -o my_app
Resolving dependencies...
Error on line 17, column 16 of pubspec.yaml: Invalid version constraint: Could not parse version "^1.4.0". Unknown text at "^1.4.0".
  stack_trace: ^1.4.0

you will get Invalid version contraint error then the following are the possibilities.


  • Your Dart version can be outdated so you can install it using following command

brew install dart@2

sudo apt-get install dart
  • Set your path properly:
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH


Thats it...

I hope this will fix your issue.

No comments:

Post a Comment