The `runtimeType` property in Dart represents the runtime type of an object.
The syntax of double.runtimeType property is:
Type runtimeType
This runtimeType property of double a representation of the runtime type of the object.
double.runtimeType returns value of type Type
.
In this example,
str
with the value 'Hello'.runtimeType
property to get its runtime type.void main() {
String str = 'Hello';
Type type = str.runtimeType;
print('Runtime type of $str: $type');
}
Runtime type of Hello: String
In this example,
number
with the value 42.runtimeType
property to get its runtime type.void main() {
int number = 42;
Type type = number.runtimeType;
print('Runtime type of $number: $type');
}
Runtime type of 42: int
In this example,
numbers
.runtimeType
property to get its runtime type.void main() {
List<int> numbers = [1, 2, 3];
Type type = numbers.runtimeType;
print('Runtime type of numbers list: $type');
}
Runtime type of numbers list: List<int>
In this Dart tutorial, we learned about runtimeType property of double: the syntax and few working examples with output and detailed explanation for each example.