decode static method

UEpubPosition? decode(
  1. String? value
)

Implementation

static UEpubPosition? decode(String? value) {
  if (value == null || !value.startsWith("u-epub:")) return null;
  final RegExpMatch? match = RegExp(r"^u-epub:(\d+)/(\d+):(\d+)$").firstMatch(value);
  if (match == null) return null;
  return UEpubPosition(
    spineIndex: int.tryParse(match.group(1) ?? "0") ?? 0,
    blockIndex: int.tryParse(match.group(2) ?? "0") ?? 0,
    charOffset: int.tryParse(match.group(3) ?? "0") ?? 0,
  );
}