Source
static String getDisplayName(String nameOrPath) { if (nameOrPath.contains('/')) { List names = nameOrPath.split('/'); nameOrPath = names.removeLast(); while (nameOrPath == '' && !names.isEmpty) { nameOrPath = names.removeLast(); } } if (nameOrPath.contains('%')) { nameOrPath = UriComponentDecoder.decode(nameOrPath); } return nameOrPath; }