between method

String? between(
  1. String start,
  2. String end
)

Text between start and end, or null if markers are missing or out of order.

Implementation

String? between(String start, String end) {
  final s = indexOf(start);
  if (s == -1) return null;
  final from = s + start.length;
  final e = indexOf(end, from);
  if (e == -1) return null;
  return substring(from, e);
}