New Flutter project not functional workspace - visual-studio-code

The bottom bar in VS Code does not show flutter as running, and this tutorial page follows with a note about not having workspaces included. No answer as to how to include it, though.
That is why I have come here. How can I set the folder up as a proper workspace? Adding it to a workspace from the File > menu doesn't help.

When opening a Dart project we'll look for a pubspec.yaml file in the root folder that contains an sdk: flutter line to decide whether to go into "Flutter mode".
This works the same for multiple workspace folders, but the root of each will be checked and if any single project references Flutter then we'll use the Flutter SDK for them all.
If you want to open a parent folder you could also add the Flutter project directly as a workspace folder to ensure it goes into Flutter more (though you'll end up with the folder showing twice in the Explorer until VS Code implements this).

Related

When creating a new flutter project no android/ios/main.dart folder/file are showing

I know it has already been asked this, but I have read all the thread opened and tried everything and still when I create a new flutter project there's only the .idea folder and no lib/android/ios folder and main.dart showing.
I have already installed flutter/dart plugins, SDK path is set correctly, path in module (project settings) is set too.
Also flutter doctor -v is not showing any issue. Could anyone help me please? I don't know what to do.
I am usind Android Studio Eels.
Thanks!!
I think you're using the wrong way: Android Studio menĂ¹ is a little bit confusing. In order to create an empty new Flutter project, after selecting "File > New > New Flutter Project", first select "Flutter" (not "New Project") on the left, then click "Next" and follow the wizard.

New Flutter project only has .idea folder and .iml file

this is my first time actually posting a question on here, despite already having frequently browsed this wonderful platform for answers before, so apologies if there is something missing or if it isn't too clear.
I'm somewhat new to flutter and android studio, and am currently wondering why when creating a new flutter project on android studio, only the .idea folder and .iml file appear under the main folder [https://i.imgur.com/6YMkkv3.png]
I've also run flutter doctor and while it did show 2 issues, I'm almost positive they were already present before and did not pose a problem [https://i.imgur.com/1IshqrQ.pngl]
Please follow the following guide Set up an editor to set up your editor to work with Flutter, and then Test drive to create a Flutter project.
.idea is a folder that is created by Intellij IDEA and contains metadata about your workspace like settings, run configs etc..
.iml contains module metadata.
For the chrome issue, try running
flutter config --enable-web

i get "Error running 'main.dart': Entrypoint isn't within a Flutter pub root" every time i try to run my app

i'm working on app using flutter and android studio this is the error I get every time i try to run my app
i tired running other projects and they ran completely fine
This could be due to a failed rebuild.
Click on File at the top left corner on the menu bar.
Click Project Structure
Click on Module at the left end, then click on sources.
You will then see your project directory below the language level. Ensure that this path is correct and points to the root folder of your project. That is the project folder. If not update it and click Ok at the bottom of the dialog.
On the menu bar click on Build then rebuild project.
I have encountered this issue recently and I don't know how or why but I somehow my main.dart file was no longer listed as a dart file - I Resolved this by right clicking the main.dart file in Android Studio. Clicked the menu option that populates 'Mark as Dart' afterwards no issues - it compiled and a lot less hair for me.
I was having this issue and tried everything and nothing was working.
Then i realised that the pubspec.yaml was not there. So i restored it with git and poof everything was working again.
It was deleted (but not committed) and restored I it with git checkout HEAD pubspec.yaml in my case

how to fix android studio changing flutter code

There is something weird is happening in my Android Studio it changes code views, for example, I wrote a normal code and it works fine but when I want to see my code it is full of things that are not my code
it does the same to flutter itself codes
this is Flutter Container Code...it works but I can't see the code... and it is fine in VsCode
thanks in advance.
Try changing font settings as default in Android Studio.
From menu bar, File > Invalidate Caches & Restart, to clean cache and open files again.
just copy project folder and paste to other folder directory.
suppose your project is kept. and copy project folder from below folder
C:/myflutterproject
create new project directory and paste project into new folder.
C:/newmyflutterdirectory
open project from new folder.
C:/newmyflutterdirectory

Error: Entrypoint isn't within the current project

Unable to run flutter from Android Studio not detecting flutter project its shows Error: Entry point isn't within the current project
Every time restart android studio same error message shows
Delete the .idea folder inside the root of the flutter project and restart Android Studio.
Refer to this question: What is the .idea folder? and make your decision if it's safe or not to delete .idea folder.
Click on File-> Project Structure -> Module then add root folder of
your project then it will detect its a flutter app and then build and
work
its work for me
Reference: https://github.com/flutter/flutter-intellij/issues/2307
1) make sure flutter and dart sdk paths are properly configured from
File-> Settings..->Languages and Frameworks
as well as make sure Dart support is enabled for project module from Dart Option
2) at the end select File->Invalid caches and restart
3) so after 2nd step you may get in File->Project Structure.. option from there Select Modules then just simply add only root folder path of your flutter project and repeat just above 2nd step
for me this worked
Syncing your project with gradle files will solve it:
You can sync the files with Gradle, within the File menu.
Else You can re-include the files/project root folder inside the File Menu.
File -> Project Structure -> Module
And then add the root folder of the project(with + icon), then it will detect that it's a flutter app again, and then build and work again.
Try delete .idea folder inside project folder and Invalidate & Restart Android Studio.
For me my project was missing the pubspec.yaml file, it was deleted by mistake , instead of warning about the missing file , I got this error
This problem happened to me
I solved it this way
Go to the Android Studio track
I have this way
C:\Users\mustafamaxL\.AndroidStudio4.0\system
Remove folder (caches)
Then, start Android Studio again
If your ios, android, or lib folders are missing, it typically means there is something wrong with your project structure.
To fix it, delete the .idea folder in the root of your project and then restart Android Studio. If you're using a Mac, you can display the hidden .idea folder by pressing Command+Shift+Dot in Finder.
The .idea folder will be automatically regenerated and everything should be back where it belongs.
See this post for the original solution.
Click Content Root Close Icon and Remove Android Folder.
Fix it to me.
I faced the same issue today and tried other solutions here but it wasn't worked at all.
In my case I deleted three folders that is android, ios, and .idea from project directory, then restarted android studio and finally I gave this command in Android Studio's Terminal.flutter create . to create appropriate directories (i.e., android & ios).
Now it is working fine.
Note: Before deleting the android / ios directory please make a backup of these directories only if you previously gave native code in android / ios directory.
Hope this solution will helpful if others will not work.
The .idea folder will also be deleted on Linux. When Andriod Studio opens, click terminal at the bottom in Android Studio. Then type remove -r .idea/ in the terminal and press enter. After deleting, close and restart Android Studio.
You might need to update the Gradle version. Or change the minimum android SDK version.
Here is worked for me:
Update Gradle / minSdkVersion version
Reopen the project but at the directory user/StudioProjects/yourFlutterApp/android.
After it is opened it will load some packages (see right bottom), which will take some time.
It will ask you to update the Gradle version (right-left corner) or go under File>Project Structure Project you can set a higher Gradle version and under Modules variables of your build
Now you can sync your project with Gradle files
After configuration, you might need to restart your project with File>Invalid Caches/Restart....
I have created 2 folders inside lib's folder for my *pages* and *widgets*.
Getting the main.dart file back to the **lib folder** will do the trick
I'm currently in Android Studio Electric Eel.
I've done all of the suggested solutions above, but nothing works.
Turns out the project is not detected as a Flutter project. So what I do to resolve this issue is to remove gradle-related files from the root folder:
build.gradle
gradlew
gradlew.bat
gradle/