Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console.log in Dart Language

Tags:

console

dart

How can I log into the browser console, like console.log in JavaScript, from the Dart language?

like image 346
Andreas Köberle Avatar asked Jan 21 '12 14:01

Andreas Köberle


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 I use console log in flutter?

The Dart print() function outputs to the system console, which you can view using flutter logs (which is basically a wrapper around adb logcat). If you output too much at once, then Android sometimes discards some log lines. To avoid this, you can use debugPrint(). Show activity on this post.

What does console log () do?

The console. log() is a function in JavaScript which is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user.

What is log in Dart?

The log() function in Dart calculates the natural logarithm of a number. The image below shows the mathematical representation of the log() function. The dart:math module is required for this function.


1 Answers

Simple:

print('This will be logged to the console in the browser.'); 

A basic top-level print function is always available in all implementations of Dart (browser, VM, etc.). Because Dart has string interpolation, it's easy to use that to print useful stuff too:

var a = 123; var b = Point(2, 3); print('a is $a, b is ${b.x}, ${b.y}'); 
like image 75
munificent Avatar answered Oct 05 '22 09:10

munificent