splitIntoSubstrings method

  1. @visibleForTesting
List<String> splitIntoSubstrings(
  1. String text
)

Implementation

@visibleForTesting
List<String> splitIntoSubstrings(String text) {
  final List<String> substrings = [];
  final RegExp regex = RegExp(r'(\{(?:[^{}]|\{[^{}]*\})*\}|[^{}]+)');
  final Iterable<Match> matches = regex.allMatches(text);
  for (final Match match in matches) {
    substrings.add(match.group(0)!);
  }
  return substrings;
}