Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter fails on `flutter` command

Tags:

flutter

dart

I'm following the Getting Started with Flutter guide and getting stuck when running the actual flutter command:

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
               ^^^^^^
Unhandled exception:
Uncaught Error: FileSystemException: Cannot open file, path = '/Users/craig/Code/flutter/packages/flutter_tools/packages/sky_tools/executable.dart' (OS Error: No such file or directory, errno = 2)
Stack Trace:
#0      _File.open.<anonymous closure> (dart:io/file_impl.dart:349)
#1      _RootZone.runUnary (dart:async/zone.dart:1151)
#2      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#3      _Future._propagateToListeners (dart:async/future_impl.dart:579)
#4      _Future._completeWithValue (dart:async/future_impl.dart:339)
#5      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:401)
#6      _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#7      _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#8      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)

#0      _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:883)
#1      _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#2      _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#3      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
Unhandled exception:
Uncaught Error: FileSystemException: Cannot open file, path = '/Users/craig/Code/flutter/bin/cache/flutter_tools.snapshot' (OS Error: No such file or directory, errno = 2)
Stack Trace:
#0      _File.open.<anonymous closure> (dart:io/file_impl.dart:349)
#1      _RootZone.runUnary (dart:async/zone.dart:1151)
#2      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#3      _Future._propagateToListeners (dart:async/future_impl.dart:579)
#4      _Future._completeWithValue (dart:async/future_impl.dart:339)
#5      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:401)
#6      _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#7      _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#8      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)

#0      _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:883)
#1      _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#2      _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#3      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
like image 640
cilphex Avatar asked Nov 10 '15 02:11

cilphex


People also ask

How do you solve a flutter error?

As stated in the error, "to fix this problem, create a new project by running flutter create -t app and then move the dart code, assets and pubspec. yaml to the new project." What you need to do is run the command line command `flutter create -t app ' (where is the location of the new project.

How do I fix RenderFlex in flutter?

To fix A RenderFlex overflowed by pixels you just have to Wrap Image in flex widget Expanded , height available is calculated then shared among Expanded (as constraints) and Image is resized to fit inside Expanded constraints.

How do you ignore deprecated in flutter?

It is being deprecated in favor of Android embedding v2. Follow the steps at https://flutter.dev/go/android-project-migration to migrate your project. You may also pass the --ignore-deprecation flag to ignore this check and continue with the deprecated v1 embedding.


1 Answers

Looks like your Dart version is outdated < 1.9.2.
Try dart --version to get the version of your installed Dart SDK.
Current is 1.12.x.

Update 2018-03-20

During the migration phase to Dart 2 you might want to install Dart from the dev channel to get a 2.0.0-alpha.x version. The newest stable version is 1.24.x

For example

brew install dart --devel

Update 2018-06-21

Now also supported:

brew install dart@2
like image 118
Günter Zöchbauer Avatar answered Sep 24 '22 03:09

Günter Zöchbauer