Google is committed to advancing racial equity for Black communities. See how.

stringProperty method

StringProperty stringProperty (String name)

Returns a StringProperty with name on this node.

If a StringProperty with name already exists and is not deleted, this method returns it.

Otherwise, it creates a new property initialized to the empty string.

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

Implementation

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