Is there a REPL for Dart to experiment with?
I tried inputing dart code in devtools in Dartium and that also didn't work.
So I couldn't find an easy way to play with various APIs in dart.
The Dart REPL allows you to evaluate Dart expressions and statements in an interactive shell.
main - the entry point of our program. void - the keyword that tells the compiler that we are not returning anything from the function. print - the print function is used to print (output) whatever we put inside the parentheses.
If you simlpy want to print text to the console you can use print('Text') . But if you want to access the advanced fatures of the DevTools console you need to use the Console class from dart:html : Console. log('Text') . It supports printing on different levels (info, warn, error, debug).
I tried inputing dart code in devtools in Dartium and that also didn't work.
I'm very new to Dart, but something I came across was that you CAN evaluate code in Dartium. In order to do so, you must first load a page with Dart code in it and then toggle this selector in the console from "javascript page context" to one that references a Dart package or Dart code.
Once you do that you should be able to execute Dart in the console:
As a VIM user, I hardly have to open the Dart Editor now :). I should also mention that breakpoints, hovering over stepped into code to get variable details, navigating the call stack, and some level of intellisense in the console also work. I couldn't get conditional breakpoints to work, though.
Though it is not really a REPL, you may find the Try Dart online tool useful for playing around. It's a bit slow, since it is actually compiling the Dart code to JavaScript in order to have it work within the browser.
There is also a console that someone built, which is probably better if you're looking for a real REPL, but it requires a bit of setup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With