Google celebrates Hispanic Heritage Month. See how.

intProperty method

*[<Null safety>](*

IntProperty? intProperty (String name)

Returns an IntProperty with name on this node.

If an IntProperty with name already exists and is not deleted, this method returns it.

Otherwise, it creates a new property initialized to 0.

Throws InspectStateError if a non-deleted property with name already exists but it is not an IntProperty.


IntProperty? intProperty(String name) {
  if (_writer == null) {
    return IntProperty.deleted();
  if (_properties.containsKey(name)) {
    if (_properties[name] is! IntProperty) {
      throw InspectStateError(
          "Can't create IntProperty named $name; a different type exists.");
    return _properties[name] as IntProperty?;
  return _properties[name] = IntProperty._(name, this, _writer!);