parse method

  1. @override
int parse(
  1. String input
)
override

Parses input and returns the numeric value.

Throws FormatException when input cannot be parsed by this codec.

Implementation

@override
int parse(String input) {
  final trimmed = input.trim();
  if (trimmed.isEmpty) {
    throw FormatException('Expected a byte size.', input);
  }

  final match = _unitMatcher.match(trimmed);
  final value = style.parse(match.number) * match.unit.scale;
  return _parseWholeByteCount(value, input);
}