splitByLastOccurrenceOf method

List<String> splitByLastOccurrenceOf(
  1. String separator
)

Implementation

List<String> splitByLastOccurrenceOf(String separator) {
  final splitIndex = lastIndexOf(separator);
  if (splitIndex == -1) {
    return [this];
  }
  return [
    substring(0, splitIndex),
    substring(splitIndex + separator.length),
  ];
}