keyProtectorsExtractValue static method

List<String> keyProtectorsExtractValue(
  1. String output
)

Implementation

static List<String> keyProtectorsExtractValue(String output) {
  List<String> keyProtectors = [];
  bool isParsing = false;

  for (var line in output.split('\n')) {
    // Remove leading and trailing whitespace
    line = line.trim();

    if (line == 'Key Protectors:') {
      isParsing = true;
    } else if (isParsing && line.isNotEmpty) {
      keyProtectors.add(line);
    } else if (isParsing && line.isEmpty) {
      // Stop parsing once an empty line is encountered
      break;
    }
  }

  return keyProtectors;
}