Using an interactive shell (REPL)

Using an interactive shell (REPL)

How to:

Dart does not come with an inbuilt REPL. However, you can achieve REPL-like functionality using the DartPad (online) or by utilizing third-party tools like dart_repl.

Using DartPad:

DartPad ( is an online Dart editor that lets you write and run Dart code in your web browser. Although not a traditional command-line REPL, it provides a similar experience for rapid experimentation.

Simply go to the website, type your Dart code on the left pane, and click “Run” to see the output on the right.


void main() {
  print('Hello, Dart!');


Hello, Dart!

Using dart_repl (third-party tool):

First, install dart_repl via pub globally:

dart pub global activate dart_repl

Then, run dart_repl from your terminal:


Now, you can start typing Dart statements directly into the shell. For example:

>>> print('Hello, REPL!');
Hello, REPL!
>>> int add(int x, int y) => x + y;
>>> print(add(5, 7));

These methods provide a swift pathway for trying out Dart code on-the-fly, significantly easing the learning curve and enhancing productivity.