between method

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

Implementation

String? between(String start, String end) {
  final startIndex = indexOf(start);
  final endIndex = indexOf(end);
  if (startIndex == -1) return null;
  if (endIndex == -1) return null;
  if (endIndex <= startIndex) return null;

  return substring(startIndex + start.length, endIndex).trim();
}