extension function

String extension (String path)

Gets the file extension of path: the portion of basename from the last . to the end (including the . itself).

p.extension('path/to/foo.dart');    // -> '.dart'
p.extension('path/to/foo');         // -> ''
p.extension('path.to/foo');         // -> ''
p.extension('path/to/foo.dart.js'); // -> '.js'

If the file name starts with a ., then that is not considered the extension:

p.extension('~/.bashrc');    // -> ''
p.extension('~/.notes.txt'); // -> '.txt'

Implementation

String extension(String path) => context.extension(path);