简体   繁体   中英

Flutter, android studio. main.dart file opens every run

I'm using Flutter with Android Studio. Everytime I run the app, in android studio, Main.dart file shows, meaning it comes into focus over any other class I have open. Its really annoying. Can I stop this? Thanks

I'm not sure if I understand what you're trying to ask, but If I'm understanding correctly you're trying to have another class run first before main.dart .

Before I answer you should know that the first thing that runs when you run an app in flutter is the main() method (just like in java) and by default the main() method is located in the main.dart file.

So if you for some reason don't want the main.dart file to run first then just move the main() method to the class you want to run first (but thats pointless, because there's no need to do that),

But if you want another screen(page) to run first ex login, signup etc, then you just need to specify that in the home attribute of the MatterialApp() Widget.

And the other way I understood your question was that you want the last view that you were working before you closed the project or Android Studio to show up first and not the main.dart file if this is what you meant then this is the default settings of Android Studio so just turn the settings to default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM