Ask coding questions

← Back to all posts
How can i run another file other than main.dart
henrytirla (0)

Hello ,
I am trying to run another dart file but when i press the run button it seems to only run the main.dart

Comments
hotnewtop
Wumi4 (531)

Move to the Shell tab on the console of your Repl. Then type:

dart <file>

With <file> is the Dart file you want to run. I'm sure it will work.

SixBeeps (5233)

@Wumi4 Can confirm that this works, though for Dart Repls, the Console tab reads bash commands, so you don't need to switch to the Shell tab in this case.

henrytirla (0)

@Wumi4 I tried and it works fine . Thank you. Any idea on how to make it run with the run button ?

InvisibleOne (2934)

I believe that you should be able to make a .replit file with run="dart FileName" to point it to a file you want it to use as the entry point. Although I haven't confirmed if this works.