getSize static method

double? getSize(
  1. UnitValue? unitValue,
  2. double space
)

Implementation

static double? getSize(UnitValue? unitValue, double space) {
  final real = unitValue?.type == UnitType.PERCENT ? null : unitValue?.value;
  final percent = unitValue?.type == UnitType.PERCENT ? unitValue?.value : null;

  if (real != null) return real.toDouble();
  if (percent != null) return (percent.toDouble() / 100) * space;
}