dart Classes Creating a class


Example

Classes can be created as follow:

class InputField {
  int maxLength;
  String name;
}

The class can be instantiated using the new keyword after which the field values will be null by default.

var field = new InputField();

Field values can then be accessed:

// this will trigger the setter
field.name = "fieldname";

// this will trigger the getter
print(field.name);