diff --git a/lib/src/units/energy_density/energy_density_unit.dart b/lib/src/units/energy_density/energy_density_unit.dart index 38dfb4d..5ff528d 100644 --- a/lib/src/units/energy_density/energy_density_unit.dart +++ b/lib/src/units/energy_density/energy_density_unit.dart @@ -58,6 +58,15 @@ enum EnergyDensityUnit implements LinearUnit { @override final String symbol; + /// Returns `true` only for [joulePerCubicMeter], the SI derived unit of energy density. + @override + bool get isSI => this == EnergyDensityUnit.joulePerCubicMeter; + + /// Returns `true` for all units, since every `EnergyDensityUnit` member is + /// a decimal metric unit. + @override + bool get isMetric => true; + // --- Pre-calculated direct conversion factors --- final double _factorToJoulePerCubicMeter; final double _factorToJoulePerLiter; diff --git a/lib/src/units/volumetric_flow_rate/volumetric_flow_rate_unit.dart b/lib/src/units/volumetric_flow_rate/volumetric_flow_rate_unit.dart index 58d5c83..7fdd314 100644 --- a/lib/src/units/volumetric_flow_rate/volumetric_flow_rate_unit.dart +++ b/lib/src/units/volumetric_flow_rate/volumetric_flow_rate_unit.dart @@ -70,6 +70,22 @@ enum VolumetricFlowRateUnit implements LinearUnit { @override final String symbol; + /// Returns `true` only for [cubicMeterPerSecond], the SI derived unit of volumetric flow rate. + @override + bool get isSI => this == VolumetricFlowRateUnit.cubicMeterPerSecond; + + /// Returns `false` for the imperial/US customary [cubicFootPerSecond], + /// [cubicFootPerMinute], [gallonPerMinute], and [gallonPerHour]; `true` + /// for all decimal metric cubic-meter- and liter-based units. + @override + bool get isMetric => switch (this) { + VolumetricFlowRateUnit.cubicFootPerSecond || + VolumetricFlowRateUnit.cubicFootPerMinute || + VolumetricFlowRateUnit.gallonPerMinute || + VolumetricFlowRateUnit.gallonPerHour => false, + _ => true, + }; + // --- Pre-calculated direct conversion factors from this unit to all others --- final double _factorToCubicMeterPerSecond; final double _factorToCubicMeterPerMinute;