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