Visual Studio Code gives errors when i try to use extensions in my flutter app
and i guess i have required version of dart installed
As per the first error i have enabled experiments in analysis_options.yaml (suggested in this link )
Please suggest if i am going wrong anywhere or missing the inclusion of any dependencies?
You have a correct version of Flutter/Dart, which should have extension methods enabled.
Are you sure that your VS Code is using that version?
Try opening "settings" in VS Code (File > Preferences > Settings) and enter (copy) the following into the search field:
#ext:dart-code.dart-code sdkPath
This should show a number of entries, Dart: Sdk path(s) and Dart: Flutter Sdk path(s). If any of these are set, it might be used instead of the Flutter SDK that you see on the command line.
Related
I am new in android studio and flutter and I have encountered several problems after installing them. I already went to flutter doctor and it's all checked so flutter isn't the problem. I can't start coding because of these problems:
Here the sample code made by flutter itself I can't run it has several errors and
Here I can't run any virtual device because it says that I don't have an internet connection which is not true. I cannot code if I can't run the sample dummy code.
Thanks
I think you haven't properly done the setup for Android Studio. Please check the documentation where you will get steps for proper installation.
Few things which you can check:
Flutter and Dart plugins should be installed in Android Studio
If you want to run on an emulator, you will have to download the image for it whose answer you can find in previous answers.
When you first open Android Studio, you should get an option to create a Flutter Application.
Try to reinstall android studio with stable internet connection.
i would advise you to follow below steps to download system images to create virtual device
Select sdk manager
Download a system image by selecting show package details.You can download api32 system images which is the latest for now.
Once downloaded you can see the image file while created avd.
Some errors i got and how i fixed it
(ERROR 1) [flutter] flutter doctor -v 'crumb' is not recognized as an internal or external command, operable program or batch file. Error: Unable to find git in your PATH. exit code 1
(FIX) Go to flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (20) that says
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The code should look like this on those lines
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
Save and Run flutter doctor and everything should work fine.
(ERROR 2) flutter doctor takes too long
(fix) I downloaded the previous version of the sdk it worked like a charm
(ERROR 3) Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.
(fix) Open Android Studio
Tools Menu, SDK Manager
In the window that comes up there are inner panels, choose SDK Tools panel
Tick Android SDK Command-line Tools
Choose Apply button near the bottom of the window
This worked
(ERROR 4) `The term 'flutter' is not recognized as the name of a cmdlet, function, script file, or operable program.
(fix) put the correct part in the env variables like i had put D:\flutter insted of D:\flutter\bin that worked
So, I’m using flutter version 2.2.3 and can’t upgrade right now. But, my other project need higher SDK. I know, there is FVM. But I found this: How to use two version of flutter on same device for different projects? and cite the article: https://dartcode.org/docs/quickly-switching-between-sdk-versions/
The article said, we can quickly switch flutter version via clickable status bar after applied git worktree. But, in my VSCode, flutter version not clickable.
Any suggestion please?
I’ve found the answer:
Open workspace setting with CMD + SHFT + P, I choose not JSON version
Search for “SDK”
Add item with both of flutter version (mine: /User/me/flutter and /User/me/flutter-master)
And voila! I can choose other versions
FVM is a good choice, but if you want to use built-in mechanism, you'll have to:
Download different Flutter versions (from here)
In VSCode set SDK paths (inside .vscode/settings.json file for single project or globally in settings):
{
"dart.sdkPaths": [
"/Users/user/flutter/stable"
"/Users/user/flutter/beta"
]
}
if you are using vs code you can click ctrl+shift+p or command+shift+p
and search for "select SDK" and select your SDK.
I am trying to learn how to use Flutter and am using Visual Studio Code. When in Visual Studio Code and with a project selected, I try to: run > run without debugging. I am then supposed to see a list of my installed extensions to choose between - something like this:
but instead I see:
as if there are no extensions installed. However you can see:
that I do have Flutter and Dart extensions installed.
So I'm trying to figure out why my extensions are not showing. Any help gratefully received!
I am using Ubuntu 18.04.
You need to open main.dart or any other dart file. Then do run without debugging.
The VSCode Intellisense doesn't provide any suggestions for any single file packages in Flutter.
I've tried this on my own plugin as well as the Webview plugin
https://pub.dev/packages/webview_flutter
However, the Intellisense works if the package is created like this (library keyword is used) -
library nearby_connections;
export 'src/classes.dart';
export 'src/defs.dart';
export 'src/nearby_connections.dart';
Is this some issue via VSCode, can I resolve it somehow by changing some configurations?
Opening a loose file is not currently supported (see https://github.com/Dart-Code/Dart-Code/issues/602), you need to open a folder. In the latest version of the Dart extension for VS Code, a warning will be shown if you do this explaining how to resolve it.
I'm not entirely sure how much information is needed for this error, but I'm trying to migrate a multi-project product from Eclipse to Android Studio. I can't get very far, though, because I get the below-screenshot error:
As you see here, it says I should set the SDK directory in local.properties, but
I have, and it's the correct location, and it still doesn't work. How do I fix this error?
You could try setting the ANDROID_HOME environment variable.
Open a terminal window, and execute the following commands:
export ANDROID_HOME=/Users/benleggiero/code/android-sdk-macosx
export PATH=$PATH:$ANDROID_HOME/bin
Then I would restart Android Studio.