extension property

String get extension

Returns the file extension of the path, the portion of the name from the last '.' to the end (including the '.' itself).

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

If the filename starts with a '.', then that is not considered an extension.

File('~/.profile').extension;    // -> ''
File('~/.notes.txt').extension;    // -> '.txt'

Implementation

String get extension => path_helper.extension(path);