RequestRange.parse constructor

RequestRange.parse(
  1. String? raw
)

Implementation

RequestRange.parse(String? raw) {
  if (raw == null) {
    return;
  }
  RegExpMatch? matcher = RegExp('bytes=(\\d+)?-(\\d+)?').firstMatch(raw);
  if (matcher != null) {
    specified = true;
    begin = matcher.group(1) == null ? null : int.parse(matcher.group(1)!);
    end = matcher.group(2) == null ? null : int.parse(matcher.group(2)!);
    if (begin == null) {
      suffixLength = end;
      end = null;
    }
  }
}