The syntax of Map.toString() method is:
String toString()
This toString() method of Map a string representation of this object.
Map.toString() returns value of type String
.
In this example,
number
with the value 42.toString()
method on number
to convert it to a string.void main() {
var number = 42;
print(number.toString());
}
42
In this example,
character
with the value 'A'.toString()
method on character
to convert it to a string.void main() {
var character = 'A';
print(character.toString());
}
A
In this example,
message
with the value 'Hello, world!'.toString()
method on message
to convert it to a string.void main() {
var message = 'Hello, world!';
print(message.toString());
}
Hello, world!
In this Dart tutorial, we learned about toString() method of Map: the syntax and few working examples with output and detailed explanation for each example.