order property

double get order

The physical order, with mezzanines after their corresponding floor.

Implementation

double get order {
  final number = int.tryParse(code.replaceAll(RegExp('[^0-9]'), '')) ?? 0;
  if (code.startsWith('R')) {
    return 100 + number.toDouble();
  }
  final base = code.startsWith('B') ? -number.toDouble() : number.toDouble();
  return base + (code.endsWith('M') ? 0.5 : 0);
}