fileName property

String get fileName

Implementation

String get fileName {
  var prefix = '';
  if (segments case final segments when segments.isNotEmpty) {
    prefix = p.joinAll(segments);
  }

  var file = basename;

  if (extension case final ext? when ext.trim().isNotEmpty) {
    file = p.setExtension(
      file,
      '.${ext.trim().replaceAll(RegExp(r'^\.+'), '')}',
    );
  }

  return p.join(prefix, file);
}