tomSecretsBlockOf function

List<String>? tomSecretsBlockOf(
  1. String text
)

The lines between the marks of text's block, or null when it has none.

Implementation

List<String>? tomSecretsBlockOf(String text) {
  final lines = text.split(RegExp(r'\r?\n'));
  final begin = lines.indexWhere((l) => l.trim() == tomSecretsBlockBegin);
  if (begin < 0) return null;
  final end = lines.indexWhere((l) => l.trim() == tomSecretsBlockEnd, begin);
  if (end < 0) return null;
  return lines.sublist(begin + 1, end);
}