how to create object for class in dart code example
Example: object in dart
// Class declaration
class Car {
String model;
int year;
var serialNumber;
// Constructor
Car(this.model, this.year, this.serialNumber);
}
// Follow me on Grepper for any future Dart Questions! Hope this Helps...
void main() {
// Creating Object
Car Honda = new Car('Civic', 2021, 'HZ326Y');
print(Honda.year);
}
/* Syntax
class class_name {
<fields>
<getters/setters>
<constructors>
<functions>
} */