State | Describes the object. The fields of a class represent the object’s state. |
Behavior | Describes what an object can do. |
Identity | A unique value that distinguishes an object from a set of similar other objects. Two or more objects can share the state and behavior but not the identity. |
The Cascade operator
Example
class Student {
void test_method() {
print("This is a test method");
}
void test_method1() {
print("This is a test method1");
}
}
void main() {
new Student()
..test_method()
..test_method1();
}
=> output
This is a test method This is a test method1
The toString() method
void main() {
int n = 12;
print(n.toString());
}
=> output
12