fileName property

  1. @useResult
String? get fileName

Returns the file name from this URI path, or null if the path is empty. Audited: 2026-06-12 11:26 EDT

Implementation

@useResult
String? get fileName {
  if (path.isEmpty) {
    return null;
  }

  final String lastSegment = path.split('/').lastOrNull ?? '';

  return lastSegment.isEmpty ? null : lastSegment;
}