PemPart.decodeLabelled constructor

PemPart.decodeLabelled(
  1. String pem,
  2. List<String> labels
)

Implementation

factory PemPart.decodeLabelled(String pem, List<String> labels) {
  final lines = pem.split(_newlineRegexp).reversed.toList();

  while (true) {
    final part = _decodeNextPem(lines);
    if (part == null) break;

    if (labels.contains(part.label)) return part;
  }

  throw Exception('No block found');
}