Flutter doesn't build new code and keep the outdated
I have a problem..flutter doesn't build new code with hot reload nor restart ..every time I have to delete build folder, run flutter clean and run flutter pub get && flutter run and this happen with any new project I create
Beside that, These command doesn't work in vscode terminal it must be Linux terminal..when i run flutter doctor in Linux terminal it works fine but in vscode terminal it says:
[✗] Android toolchain - develop for Android devices
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
however i have installed cmdline-tools and all sdk tools from Android Studio.
I tried to uninstall vscode and flutter and reinstall them but the issues are still the same.
So I am trying to run this command in terminal
flutter pub run intl_translation:extract_to_arb --output-dir=lib/i18n lib/i18n/app_localization.dart
and I get this error
Dart 2.15.1 is incompatible with your dependencies' SDK constraints. Please run "flutter pub get" again.
pub finished with exit code 65
And I noticed that the used Dart version is 2.15.1 and not version 2.10.5 which is specified in the Android Studio project settings
How would I change the actually used Dart version to be able to run the intl_translation command ?
You can download the version you want from this link. https://dart.dev/get-dart/archive
From SDK manager in android studio you can change the flutter SDK and dart SDK to the path of the versions you want to use.
And then restart IDE
I ran the following commands in my foo project:
iDecode#iDecodes-Mac foo % pub get
Resolving dependencies...
The current Dart SDK version is 2.7.2.
Because foo requires SDK version >=2.12.0 <3.0.0, version solving failed.
iDecode#iDecodes-Mac foo % flutter --version
Flutter 2.6.0-11.0.pre • channel dev
Tools • Dart 2.15.0 (build 2.15.0-116.0.dev)
My pubspec.yaml file has:
environment:
sdk: '>=2.12.0 <3.0.0'
As you can see my current Dart SDK version is set to 2.7.2, my project is targeting a min of 2.12.0 and Dart SDK installed on my machine is 2.15.0. So, how do I change the current Dart SDK version?
This is my ~/.zshrc file
export PATH=/flutter/bin:$PATH
export PATH=$PATH:/$HOME/Library/Android/sdk/platform-tools/
export PATH="$PATH:/$HOME/flutter/bin"
export PATH="$PATH":"$HOME/.pub-cache/bin"
export JAVA_HOME=$(/usr/libexec/java_home)
It seems like you installed Flutter/Dart SDK somewhere using Homebrew. Use which flutter and which dart to see the actual Flutter/Dart command that is taking effect. Once you find where your Dart SDK is you can use
brew uninstall dart
After this when you run which dart it will now point to where your Flutter SDK was installed.
You can also try this way:
Just download that specific flutter version from here. and just set the flutter version in your editor and try to run it will run that specific flutter version but make sure you can't run that with terminal commands. So you need to handle all commands from the Tools option.
set flutter version
Must Run commands from here
The dart version is related with flutter version, see which version is what you need here
https://docs.flutter.dev/development/tools/sdk/releases
Upgrade by running flutter upgrade [check it out here] (update dart sdk for flutter)
Flutter comes with dart by default. Suggestion is to delete old flutter, delete .zshrc and download the latest stable version 2.5.3 for your mac and then give path for it in your .zshrc. Other method is switch to flutter stable by running flutter channel stable and then give flutter upgrade command so it will catch all the stuff from git in you local machine and you'll be good to go.
Simply go to the location where Dart SDK is kept and delete that and install a new Dart SDK version from the official website which is
https://dart.dev/get-dart
I had that same issue
Resolving dependencies... (5.3s)
The current Dart SDK version is 2.17.0.
Because talk_to_me depends on browser >=0.3.1+1 which requires SDK version
<2.0.0, version solving failed
I think we need to uninstall dart and install the correct version
To uninstall dart:
sudo apt purge dart
I don't know how to fix this problem.
I tried to uninstall and install the Flutter & Dart plugin.
i am trying to install this package "modal_progress_hud".
modal_progress_hud: ^0.1.3
flutter pub get runs successfully but when i try to import the package, it doesn't work as it is shown in the picture.
Running "flutter pub get" in my_project... 0.6s
Process finished with exit code 0
i tried the same process with other packages and it works fine. is it because of the package or what might be the problem? i also ran flutter clean, pub cache repair, flutter pub upgrade, restart Android studio as well as my mac but nothing worked.