asNumber method
Returns this value as a number with its optional unit.
Implementation
PsDescriptorNumber? asNumber() => switch (this) {
PsIntegerValue(:final int value) => PsDescriptorNumber(value: value.toDouble(), unit: null),
PsLargeIntegerValue(:final int value) => PsDescriptorNumber(value: value.toDouble(), unit: null),
PsDoubleValue(:final double value) => PsDescriptorNumber(value: value, unit: null),
PsUnitFloatValue(:final String unit, :final double value) => PsDescriptorNumber(value: value, unit: unit),
_ => null,
};