| |
| |
| |
| # boolProperty method |
| |
| |
| |
| |
| *[<Null safety>](https://dart.dev/null-safety)* |
| |
| |
| |
| |
| [BoolProperty](../../package-fuchsia_inspect_inspect/BoolProperty-class.md)? boolProperty |
| (String name) |
| |
| |
| |
| |
| |
| <p>Returns an <a href="../../package-fuchsia_inspect_inspect/BoolProperty-class.md">BoolProperty</a> with <code>name</code> on this node.</p> |
| <p>If an <a href="../../package-fuchsia_inspect_inspect/BoolProperty-class.md">BoolProperty</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 false.</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 a <a href="../../package-fuchsia_inspect_inspect/BoolProperty-class.md">BoolProperty</a>.</p> |
| |
| |
| |
| ## Implementation |
| |
| ```dart |
| BoolProperty? boolProperty(String name) { |
| if (_writer == null) { |
| return BoolProperty._deleted(); |
| } |
| if (_properties.containsKey(name)) { |
| if (_properties[name] is! BoolProperty) { |
| throw InspectStateError( |
| "Can't create BoolProperty named $name; a different type exists."); |
| } |
| return _properties[name] as BoolProperty?; |
| } |
| return _properties[name] = BoolProperty._(name, this, _writer!); |
| } |
| ``` |
| |
| |
| |
| |
| |
| |
| |