String substringBeforeLast(String separator) { final index = lastIndexOf(separator); return substring(0, index); }