When I start a debugging session (pressing F5) I receive the following messages:
dart:ui:1: Error: Not found: dart:ui.
Exited (sigterm)
There is no indication as to where the problem occurred. Output from flutter doctor -v is:
[√] Flutter (Channel beta, v0.8.2, on Microsoft Windows [Version 6.1.7601], locale en-US)
• Flutter version 0.8.2 at C:\Downloads\flutter\flutter_windows_v0.5.1-beta\flutter
• Framework revision 5ab9e70727 (2 weeks ago), 2018-09-07 12:33:05 -0700
• Engine revision 58a1894a1c
• Dart version 2.1.0-dev.3.1.flutter-760a9690c2
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at C:\Users\gggustafson\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 26.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] VS Code, 64-bit edition (version 1.25.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 2.18.0
[√] Connected devices (1 available)
• SM G925V • 06157df60c7a8e20 • android-arm64 • Android 7.0 (API 24)
• No issues found!
Any thoughts?
When running the app, you will find 2 main.dart
Choose the one with the flutter icon beside it
If you are running flutter project.
In edit configuration, run it as flutter project,which has a flutter icon besides it.
If you are testing a dart file
Check your denpendency tree. Delete all flutter related lib like widgets/material/cupertino.
Simple explaination
In short, you are running a file as dart file, but you have imported flutter dependencies like widgets/material at the same time. Either run it as flutter ,or get rid of flutter dependency and run pure dart.
Magically if you add:
import 'package:flutter/widgets.dart';
at the top of that file you want to Run or Debug, and delete the existing configuration, it will run as flutter instead of dart.
Why? Idea/Android Studio scans the file that you're asking to Run or Debug for flutter imports and uses that to decide whether the initial run configuration should be a dart or flutter one. If you import any flutter packages, you get a flutter run configuration.
Confusingly, it does this only the first time you Run/Debug that file, and remembers the run configuration.
If your run configuration was created as the wrong kind (Dart instead of Flutter), you'll need to go into the "Edit Configurations" menu to delete it, than are to Run/Debug that file again.
Its very confusing behavior, particularly since your imports are insufficient to know whether the file should be run as Flutter or plain old Dart -- your file's import may import another file that imports a flutter library. It may be detected as Dart, when Flutter it the right configuration.
They should have just added "Run Dart", "Run Flutter".
If you are using VS Code as your IDE then choose Start Debugging instead of Run Code and it will work.
While running choose the one with the flutter icon and it should help.
import this liberary
import 'dart:ui' as ui;
Related
my problem is this:
I want to connect my app to Firebase. I followed all the steps and did everything according to the instructions. When I tried to debug the app, the following error came up:
When I enter - flutter run - from the terminal, the following happens:
In flutter doctor -v the following comes out:
[✓] Flutter (Channel stable, 1.20.4, on macOS 11.2 20D64, locale de)
• Flutter version 1.20.4 at /Users/danielalakin/development/flutter
• Framework revision fba99f6cf9 (5 months ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK
version 30.0.2)
• Android SDK at /Users/danielalakin/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.19.0
[✓] Connected device (1 available)
• iPhone 12 Pro Max (mobile) • C0991E0B-425B-46BD-9DEA-674181136D99 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
And I have the following versions and paths:
$ pod --version:
1.10.1
$ which pod:
/usr/local/bin/pod
$ which gem:
/Users/danielalakin/.rvm/rubies/ruby-3.0.0/bin/gem
$ which ruby:
/Users/danielalakin/.rvm/rubies/ruby-3.0.0/bin/ruby
Do you know how I can solve this problem?
PS: I work on Visual Studio Code and XCode. I use MacOS Big Sur Version 11.2.
I had this same error a number of times in the past, and once right after I upgraded to Flutter 2.0.1 just now. The solution for me was always to run (as previously suggested):
sudo gem install cocoapods then restart my IDE. I use Android Studio, but same should apply to VSCode as well.
The only command who work for me is this one :
brew install cocoapods
For me none of these was helpful,
The workaround was opening the Android studio using Terminal rather than GUI
open /Applications/Android\ Studio.app
After that, I can use GUI and there was no problem :)!
you can find more info here:
https://github.com/flutter/flutter-intellij/issues/4981#issuecomment-751443625
Restarting VSCode usually fixes the problem, but make sure to close it completely - Cmd+Q on macOS.
Another thing worth trying is cleaning XCode workspace, this can be done via flutter clean command.
You can try:
sudo gem install cocoapods
if you use Android Studio try restoring the cache in
file -> invalidate cache/restart
In my case I had to reinstall cocoa pods but additionally I had to reinstall my Visual Studio Code IDE.
I ran into this problem on Android Studio 4.1.3. Updating to Bumblebee 2021.1.1 Patch 3 solved it for me.
run this command :
sudo gem install ffi
if on running flutter doctor, it still says cocoapods not installed then run this command
sudo gem install cocoapods
I have been trying to solve this problem:
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
1 warning generated.
/Users/ME/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_datetime_picker-1.3.8/lib/src/datetime_picker_theme.dart:6:28: Error: Type 'DiagnosticableMixin' not found.
class DatePickerTheme with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
/Users/ME/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_datetime_picker-1.3.8/lib/src/datetime_picker_theme.dart:6:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
class DatePickerTheme with DiagnosticableMixin {
^
/Users/ME/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_form_builder-4.0.0-alpha.8/lib/src/fields/form_builder_chips_input.dart:95:17: Error: No named parameter with the name 'allowChipEditing'.
allowChipEditing: allowChipEditing,
^^^^^^^^^^^^^^^^
/Users/ME/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_chips_input-1.9.0-dev.1/lib/src/chips_input.dart:13:3: Context: Found this candidate, but the arguments don't match.
ChipsInput({
^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
I'm using flutter_form_builder-4.0.0-alpha.8
And this is my flutter doctor -v:
[✓] Flutter (Channel dev, 1.21.0-1.0.pre, on Mac OS X 10.15.6 19G73, locale en-US)
• Flutter version 1.21.0-1.0.pre at /Users/ME/development/flutter
• Framework revision f25bd9c55c (2 weeks ago), 2020-07-14 20:26:01 -0400
• Engine revision 99c2b3a245
• Dart version 2.9.0 (build 2.9.0-21.0.dev 20bf2fcf56)
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Applications/Android/sdk
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = /Applications/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.6, Build version 11E708
• CocoaPods version 1.9.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 48.0.2-dev.4
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.47.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.8.0
[✓] Connected device (4 available)
• iPhone 11 Pro Max (mobile) • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-6 (simulator)
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome
• No issues found!
I have done:
Everything I can do in flutter:
Didflutter clean, rebuild,
Delete Pods then do flutter pub get and pod setup and pod install
Did flutter upgrade
Delete and reinstall flutter, cocoapods, ruby and dart
Change flutter channel between master and dev and repeat point 1. Which none works
Also have tried to use the pub.dev source and pub.flutter-io.cn. Both gives the same result.
And now 2 days have been wasted stuck on this problem. So I suspected that there could be a problem with some package or code issue?
Any help is appreciated! Thank you
Finally I solved the problem by:
Changing DiagnosticableMixin to Diagnosticable in flutter_datetime_picker-1.3.8 as suggested here
Explanation: Apparently there is a discussion going on that is still in process. There is a note in the file flutter_datetime_picker-1.3.8.dart as follows:
Migrate DiagnosticableMixin to Diagnosticable until
https://github.com/flutter/flutter/pull/51495 makes it into stable (v1.15.21)
Commenting lines 95-97 in form_builder_chips_input.dart:
allowChipEditing: allowChipEditing,
autofocus: autofocus,
focusNode: focusNode,
For some unknown reason these three parameters are not defined in ChipsInput
Hope this helps someone because it took me awhile to solve this problems as these problems come from external packages.
Steps to Reproduce
Simply trying to publish my app to ios store. Already available on Play store.
I cannot archive in Xcode, constantly running into issues. Currently have these issues when attempting to archive:
When attempting to run pod install in the ios directory, I continue to get this warning (which according to my research seems to be more of an error):
I tried following everything in this very long thread thread to resolve this issue, but nothing has worked.
I was able to remove another warning by uncommenting line #2 in the Podfile, platform :ios, '9.0'.
I have tried closing Xcode while making changes, and have tried restarting my computer.
I can flutter run and the app will work correctly on my iPhone when it is connected to my macbook.
Other threads from which I've tried everything:
https://github.com/flutter/flutter/issues/42974
https://github.com/flutter/flutter/issues/20685
https://github.com/flutter/flutter/issues/48103
https://github.com/X-Wei/flutter_catalog/issues/26
https://github.com/flutter/flutter/issues/28870
Expected results:
I can successfully archive in Xcode.
Actual results:
Flutter doctor seems to indicate everything is fine, but I continue to get this errors when trying to archive.
AdministorsMBP4:mem_plus_plus matt$ flutter doctor --verbose
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.3 19D76, locale en-US)
• Flutter version 1.12.13+hotfix.5 at /Users/matt/development/flutter
• Framework revision 27321ebbad (9 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at /Users/matt/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.1, Build version 11A1027
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[!] IntelliJ IDEA Community Edition (version 2019.2.4)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] Connected device (1 available)
• Takkeezi’s iPhone • {redacted} • ios • iOS 12.4.4
Try to this.
flutter clean
pod install
build project
Check a pods module
Pod file
I've just upgraded my flutter, after upgradation I am unable to run any flutter project on my Android Studio. I am getting this error message.
The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.
Because buddy depends on flutter_built_redux 0.4.5 which requires SDK
version >=1.19.0 <2.0.0, version solving failed.
pub get failed (1)
How can I downgrade Dart or how can I resolve this issue, I am running android studio on mac.
I've tried by changing flutter channels dev and master but it doesn't make a difference.
flutter doctor -v result:
[✓] Flutter (Channel dev, v0.6.0, on Mac OS X 10.13.4 17E202, locale en-IN)
• Flutter version 0.6.0 at /Users/pro/Downloads/flutter
• Framework revision 9299c02cf7 (5 days ago), 2018-08-16 00:35:12 +0200
• Engine revision e3687f70c7
• Dart version 2.1.0-dev.0.0.flutter-be6309690f
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/pro/Library/Android/sdk
• Android NDK location not configured (optional; useful for native
profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-
1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.4.1, Build version 9F2000
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 27.1.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[!] Connected devices
! No devices available
flutter_built_redux package doesn't met the flutter dependency.
The error is caused by package not by flutter sdk.
see here
https://github.com/davidmarne/flutter_built_redux/blob/master/pubspec.yaml#L22
AND
you can post issue on flutter_built_redux package using this link
https://github.com/davidmarne/flutter_built_redux/issues/new?title=support%20for%20flutter%20sdk%202.1.0.dev&body=please%20upgrade%20the%20package%20for%20new%20flutter%20releases
Flutter includes a bundled Dart SDK (under its bin/cache directory) pinned to the same version used in the engine that we compile into your shipping iOS/Android app. As such, the only way to use Flutter with a different version of Dart is to use an older version of Flutter.
To do this, cd to the Flutter SDK directory. You can list the available versions by running git tag. To switch to a version, use git checkout. For example, to switch to v0.8.1 you’d run git checkout v0.8.1. When you’d like to switch back to the beta channel, run git checkout beta.
That said, generally I’d advise you to stick to beta and file an issue (or send a pull request) to the maintainer of any packages that haven’t yet been updated to Dart 2. You may also want to check the dependencies listed in your pubspec.yaml to see if there are newer versions available on pub.dartlang.org. It may just be a matter of updating your dependencies to a newer version.
I guess this is an quiver package dependency problem. Once in an update i had face same issue. That time i solve this by adding this lines to pubspec.yaml
dependency_overrides:
quiver: ^2.0.0+1
Flutter has the following channels, in increasing order of stability:
master
dev
beta
stable
Generally, I’d advise you to stick to the beta it works fine with all the packages.
It's not necessary but i think you should have to install Android Studio again with latest version.then add flutter and dart plugin there then Add Flutter SDK path in settings>Plugins>Flutter>Sdk-Path so locate your flutter sdk that you have installed in your PC may be located at C so add that path.And it may work.
And must have latest Flutter and Dart SDK installed.
You can download flutter SDK from here:
https://flutter.dev/docs/development/tools/sdk/releases
I create a flutter project, and run flutter packeages get,the output as below:
[second] flutter packages get
Waiting for another flutter command to release the startup lock...
Running "flutter packages get" in second...
The current Dart SDK version is 2.0.0-dev.63.0.flutter-4c9689c1d2.
Because second depends on flutter_test any from sdk which requires SDK version <2.0.0, version solving failed.
pub get failed (1)
exit code 1
flutter doctor -v
PS D:\dartstudy\second> flutter doctor -v
[√] Flutter (Channel dev, v0.5.7, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
• Flutter version 0.5.7 at E:\flutter
• Framework revision 66091f9696 (2 weeks ago), 2018-07-09 12:52:41 -0700
• Engine revision 6fe748490d
• Dart version 2.0.0-dev.63.0.flutter-4c9689c1d2
[√] Android toolchain - develop for Android devices (Android SDK 28.0.1)
• Android SDK at f:\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.1
• ANDROID_HOME = f:\Android\Sdk
• Java binary at: E:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.
[√] Android Studio (version 3.1)
• Android Studio at E:\Program Files\Android\Android Studio
• Flutter plugin version 26.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] VS Code, 64-bit edition (version 1.25.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 2.16.0
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
the IDE that I use to create a project is VS code.
I changed some versions of flutter sdk, the problems are the same as above,How to fix this problem?
I was having a similar issue:
Running "flutter packages get" in austin-feeds-me-flutter...
The current Dart SDK version is 2.0.0-dev.58.0.flutter-f981f09760.
Because austin_feeds_me depends on palette_generator any which requires SDK version >=2.0.0-dev.61.0 <3.0.0, version solving failed.
pub get failed (1)
Process finished with exit code 1
I fixed it with the following commands:
flutter channel dev
flutter upgrade
Fix source: https://github.com/flutter/flutter/issues/19382
just update your sdk by these codes
flutter channel dev
flutter upgrade
if you live in iran you need to use proxy because google no let you to use its packages
and for scoped_model you need to use below version of it in your pubspec.yaml file
dependencies:
scoped_model: ^1.0.1
and then save the file, your IDE automatically update the package
I solved my error by using any instead of the version codes like this
flutter_test: any
instead of
flutter_test: ^1.1.0+1
Just modify the package version in pubspec.yaml to the latest version fixed my issue.
I know this is an outdated question but I think someone will benefit from this and also the answer is relevant not outdated.
You need to fix environment: in pubspec.yaml to allow the Dart SDK version you are using (the one from Flutter)
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
The essential part is <3.0.0
Originally answered here in GitHub by someone called Günter Zöchbauer:- https://github.com/flutter/flutter/issues/21421#issuecomment-418718539
Just upgrade flutter to the latest version. This solved the problem for me.
flutter upgrade //for upgrading flutter enter this in CLI.
I found the solution of this question by myself.I add the system environment variable PUB_ALLOW_PRERELEASE_SDK=false,so Just remove this system environment variable, the question will be solved.
I have the same issue and flutter upgrade --force fixed the problem.
Note: re-run the command flutter pub get after upgrading your flutter version.
So here are some options to consider in solving this issue:
If you have tried the above solutions and it didn't work, then
You probably have issues with your flutter SDK and need to fix that first. You have changes in your flutter SDK.
To fix this, kindly cd into your flutter directory. For instance D:\repo\flutter
Find out what git changes you have in this directory using git status
Use git add * to add these changes (files) and then do git stash
To ensure that you're on the latest build from this channel, run flutter upgrade
You should be able to switch to any of your flutter channels
Stay safe. All the best
Maybe your Flutter SDK is not in the latest version. upgrade it by below command (and the documentation says, it is preferred to keep stable channel, upgrade to dev only if it essential)
flutter upgrade
I have resolved this by adding integration_test above test declaration, I saw this solution in official codelabs: https://codelabs.developers.google.com/codelabs/flutter-app-testing#2
As on pic:
I think this is a better way, than downgrading the plugin by using 'any' or changing flutter channel.
Inspect correctly your "pubspect.yaml" it's possible