Extracts the basename from a file path.
String basename(String path) { return Uri.file(path).pathSegments.lastWhere((s) => s.isNotEmpty); }