decodeRecap static method

Map<String, dynamic> decodeRecap(
  1. String recap
)

Implementation

static Map<String, dynamic> decodeRecap(String recap) {
  // Add the padding that was removed during encoding
  String paddedRecap = recap.replaceAll('urn:recap:', '');
  final padding = paddedRecap.length % 4;
  if (padding > 0) {
    paddedRecap += '=' * (4 - padding);
  }

  final decoded = utf8.decode(base64.decode(paddedRecap));
  final decodedRecap = jsonDecode(decoded) as Map<String, dynamic>;
  isValidRecap(decodedRecap);
  return decodedRecap;
}