How do I print to the console with Dart?

dart

Solution

Use `print()` to print a string to the console of your browser:

import 'dart:html';

main() {
  var value = querySelector('input').value;
  print('The value of the input is: $value');
}

You will see a message printed to the developer console.

Problem

I'd like my Dart program to print to the dev console of my browser. How can I print to the console (DevTools's console, for example) ?

Original source