getFileName static method

String getFileName(
  1. String filePath
)

Get file name from file path

filePath - The file path Returns file name with extension

Implementation

static String getFileName(String filePath) {
  final lastSlash = filePath.lastIndexOf('/');
  if (lastSlash == -1) return filePath;
  return filePath.substring(lastSlash + 1);
}