fileName function

String fileName(
  1. FileSystemEntity entity
)

Return the last segment of the file path.

Implementation

String fileName(FileSystemEntity entity) {
  final name = entity.path;
  final index = name.lastIndexOf(_sep);
  return (index != -1 ? name.substring(index + 1) : name);
}