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.
console 4.1.A library for common features required by console applications, including color formatting, keyboard input, and progress bars.
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).
you can simply use print('whatever you want to print') same as console. log() in javascript.
It's actually very simple to do in Dart:
import 'dart:html';
main() {
window.console.error('Something bad occurred');
}
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