Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

console.error() in Dart?

Tags:

dart

How do I do this console.error(foo); in Dart?

The print() method gets quite close, but it's not exactly what I want. I want to have the notification of an error and the icon along with the stack trace.

like image 787
Tower Avatar asked Nov 03 '12 11:11

Tower


People also ask

What is console in Dart?

console 4.1.A library for common features required by console applications, including color formatting, keyboard input, and progress bars.

How do you print to console in darts?

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

How do you print a function in flutter?

you can simply use print('whatever you want to print') same as console. log() in javascript.


1 Answers

It's actually very simple to do in Dart:

import 'dart:html';

main() {
  window.console.error('Something bad occurred');
}
like image 166
Kai Sellgren Avatar answered Oct 18 '22 17:10

Kai Sellgren