extension property

String? get extension

The file extension of name, without the leading dot, or null if name has none.

Delegates to package:path's extension() for the parsing (so a dotfile like .gitignore does not count as an extension), stripping the leading dot it includes to match name's own convention and the rest of this package's API (allowedExtensions is also dot-less).

Implementation

String? get extension {
  final ext = p.extension(name);
  return ext.isEmpty ? null : ext.substring(1);
}