getExtension method
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').getExtension(); // -> '.dart'
File('path/to/foo').getExtension(); // -> ''
File('path.to/foo').getExtension(); // -> ''
File('path/to/foo.dart.js').getExtension(); // -> '.js'
If the filename starts with a '.', then that is not considered an extension.
File('~/.profile').getExtension(); // -> ''
File('~/.notes.txt').getExtension(); // -> '.txt'
Implementation
String getExtension({lib_path.Context? pathContext}) {
pathContext ??= lib_path.context;
return pathContext.extension(path);
}