The syntax of Map.runtimeType property is:
Type runtimeType
This runtimeType property of Map a representation of the runtime type of the object.
Map.runtimeType returns value of type Type
.
In this example,
number
with the value 42.runtimeType
property of number
to get its runtime type.void main() {
var number = 42;
Type type = number.runtimeType;
print('The runtime type of $number is $type');
}
The runtime type of 42 is int
In this example,
text
with the value 'Hello, world!'.runtimeType
property of text
to get its runtime type.void main() {
var text = 'Hello, world!';
Type type = text.runtimeType;
print('The runtime type of $text is $type');
}
The runtime type of Hello, world! is String
In this example,
condition
with the value true
.runtimeType
property of condition
to get its runtime type.void main() {
var condition = true;
Type type = condition.runtimeType;
print('The runtime type of $condition is $type');
}
The runtime type of true is bool
In this Dart tutorial, we learned about runtimeType property of Map: the syntax and few working examples with output and detailed explanation for each example.