parseKeyMarker function

String? parseKeyMarker(
  1. String data
)

Extracts the escaped key from a bloom:key=<escaped> marker, or null.

Implementation

String? parseKeyMarker(String data) {
  final normalized = normalizeMarkerData(data);
  if (normalized.startsWith(hydrationMarkerKeyPrefix)) {
    try {
      return unescapeHydrationKey(
          normalized.substring(hydrationMarkerKeyPrefix.length));
    } on FormatException {
      // SSR output can be modified by an intermediary or contain hand-authored
      // raw HTML. Treat a corrupt marker as a hydration mismatch, not a crash.
      return null;
    }
  }
  return null;
}