setExtension method
Returns path
with the trailing extension set to extension
.
If path
doesn't have a trailing extension, this just adds extension
to
the end.
context.setExtension('path/to/foo.dart', '.js')
// -> 'path/to/foo.js'
context.setExtension('path/to/foo.dart.js', '.map')
// -> 'path/to/foo.dart.map'
context.setExtension('path/to/foo', '.js')
// -> 'path/to/foo.js'
Implementation
String setExtension(String path, String extension) =>
withoutExtension(path) + extension;