Reputation: 7176
Is it posibble in Android studio to run selected dart file as simple dart program (not like a flutter app)?
update: The reason for that behaviour was that I put the main method inside a class. When the main method inside dart file itsef there is an option available in context menu to run this file
Upvotes: 2
Views: 2070
Reputation: 99
After creating a flutter project to run selected dart file as simple dart program file in Flutter
you have to add main function like below code with you desire class name
void main() { runApp(newfile()); }
or
void main() => runApp(newfile());
then go to project bar of android studio right click on the selected file you will see Run'newfile.dart' then you will also see in the toolbar, select your app from the run configurations drop-down menu
like
Upvotes: 1
Reputation: 4109
Yes, inside that file, right click, and select run filename.dart
another way:
Upvotes: 1