Skip to content
← Back to Community
How can i run another file other than main.dart
Profile icon
henrytirla

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

Voters
Profile icon
henrytirla
Comments
hotnewtop
Profile icon
Wumi4

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.

Profile icon
SixBeeps

@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.

Profile icon
henrytirla

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

Profile icon
DaCuteRaccoon

If you know TOML and understand Replit's configuration system, just program the the run button to run your Dart file.

Profile icon
InvisibleOne

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.