| |
| |
| |
| # intProperty method |
| |
| |
| |
| |
| *[<Null safety>](https://dart.dev/null-safety)* |
| |
| |
| |
| |
| [IntProperty](../../package-fuchsia_inspect_inspect/IntProperty-class.md)? intProperty |
| (String name) |
| |
| |
| |
| |
| |
| <p>Returns an <a href="../../package-fuchsia_inspect_inspect/IntProperty-class.md">IntProperty</a> with <code>name</code> on this node.</p> |
| <p>If an <a href="../../package-fuchsia_inspect_inspect/IntProperty-class.md">IntProperty</a> with <code>name</code> already exists and is not |
| deleted, this method returns it.</p> |
| <p>Otherwise, it creates a new property initialized to 0.</p> |
| <p>Throws <a href="../../package-fuchsia_inspect_inspect/InspectStateError-class.md">InspectStateError</a> if a non-deleted property with <code>name</code> |
| already exists but it is not an <a href="../../package-fuchsia_inspect_inspect/IntProperty-class.md">IntProperty</a>.</p> |
| |
| |
| |
| ## Implementation |
| |
| ```dart |
| 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!); |
| } |
| ``` |
| |
| |
| |
| |
| |
| |
| |