extension method
Gets the file extension of path
: the portion of basename from the last
.
to the end (including the .
itself).
context.extension('path/to/foo.dart'); // -> '.dart'
context.extension('path/to/foo'); // -> ''
context.extension('path.to/foo'); // -> ''
context.extension('path/to/foo.dart.js'); // -> '.js'
If the file name starts with a .
, then it is not considered an
extension:
context.extension('~/.bashrc'); // -> ''
context.extension('~/.notes.txt'); // -> '.txt'
Implementation
String extension(String path) => _parse(path).extension;