Suppose I have a code of Dart typed in Android studio and when I run the app I want it to display the output in Android studio itself.... How can I do it because when I run the code it says me to connect a device....
Suppose I have a code of Dart typed in Android studio and when I run the app I want it to display the output in Android studio itself.... How can I do it because when I run the code it says me to connect a device....
Just create a dart file with main() method in the lib folder then you can run the file just by right click and select the run option, it will only run that particular dart file instead of your project and it will print the output on the Android Studio console
Example: File name "DartTest.dart"
print('Hellow World');
Either write it as unit test
or install the Dart SDK and create a Dart project instead of a Flutter project.
dart create dart_test
run this in a command window.
It will create a project in folder dart_test.
From android studio open this project.
Select settings and setup the Flutter sdk folder first.
Press Apply. This will set the Dart SDK also automatically.
Now right click on the bin/dart_test.dart and select Run. You can see the output in the Run Tab below.
From now on you can run the program by pressing the Run button on the top toolbar.
Remove the import statement and write fresh code in this file.
Just press the little green color icon and then run your file, but make sure there are no Flutter packages imported in your file otherwise you'll get an error.