Flutter in android studio - flutter

I created a new flutter project in android studio, but in the new version, I don't know where to find the main dart tab.
reference

You can find out main.dart in lib folder

You have to open the lib folder inside the lib folder you will get your main. dart file.

Related

Problem Import Flutter Project to Android Studio

I tried to import flutter project from my pc to the android studio and got this error.
I already read the link that they give to me but I still don't understand. A little help please, or how do I import flutter project correctly?
The error
The project is not Gradle based can be because bulid.gradle and settings.gradle are not in the IDE project directory,
Try this
Open that other folder as an Android Studio Project and let it download other dependencies and file or you can create new flutter project and check the file generated with yours and try to add the file not in your own from the new flutter project you created.
This will solve the issue
from which version/tool you imported the project?. This is normally happed because of gradle-wrapper issues. Please check the link.
https://quick-adviser.com/how-can-we-solve-project-is-not-a-gradle-based-project/
I usually solve this by File -> Repair IDE

When I'm creating Flutter new project lib folder is missing in Android Studio

When I am creating a new Flutter project in Android Studio, lib folder is missing. How to fix it?
I run Flutter doctor, everything is fine but I am facing this problem.
As "Devarsh Ranpara" comment
change Android directory to Project
Just delete .idea folder from project directory an re run android studio. it worked for me.
Hi
You should choose this option!!

Some problems with creating flutter projects with commands,please help thanks

After using the command to create a flutter project, why can't a directory be created in the lib directory? At present, it seems that only a package can be created, as shown in the figure:
Its default sturcture. your main folder is lib folder where you can add dart files.
Please check in the project structure setting - is there flutter path is set or not..if not then provide the path..
Make sure you install Flutter & dart plugin in the android studio...
Install flutter and dart first.
Set up environmentals path for flutter. Link for adding path
Fore More

Unable to create a new dart file

I can't create a new dart file in android studio.Please help
[main.dart is auto created by android studio] screen1
[flutter doctor is fine] screen2
Open your flutter project in android studio. Go to android studio settings by following this flow. File => Settings => Languages & Frameworks and select Dart check its Sdk path is it correct or not and is the dart support is enabled for your project or not.
If this is all good then by right click at lib and hover on New => Dart File give it some name (extension is not required just name it) and you are good to work in it.
You should right click on lib folder and create dart file or create file with extention .dart eg. abc.dart

flutter inspector doesn't work for the app from my github repository

The flutter inspector doesn't work (not showing widgets tree) for my project (it's cloned from github).
To figure out what's wrong in my project, I generated new flutter applications, and the behavior is weird.
When I generate a new flutter application (flutter's default new flutter project) in a NEW directory, flutter inspector works ok.
If I make a new flutter application INSIDE my project directory (let's say myproject/temp), the inspector doesn't show the widgets tree.
If I delete my project directory (myproject), make a directory with the same name (myproject), and generate a new flutter application inside the directory (myproject/temp), then the inspector works ok.
If I make 'myproject' directory manually (mkdir myproject), copy all myproject files to myproject/ (cp myproject_backup/* myproject/), and generate a new flutter application inside myproject/temp, then the inspector doesn't work.
If I make 'myproject' directory manually (mkdir myproject), generate a new flutter application inside myproject/temp, copy all myproject files to myproject/ (cp myproject_backup/* myproject/), then the inspector doesn't work.
Can the other files in the same folder (myproject/*) affect the behavior of the flutter project (esp. inspector)?
What else can go wrong in this case?
Here's my setting:
Flutter: Channel stable, v1.17.1, on Mac OS X 10.15.5
Dart: version 2.8.2
Android SDK version 28.0.3
Android Studio (version 4.0)
Flutter plugin version 46.0.2
Dart plugin version 193.7361
My app is inside bazel WORKSPACE, that was the problem.
If I delete WORKSPACE file, the inspector works fine.