setExtension function

String setExtension (String path, String extension)

Returns path with the trailing extension set to extension.

If path doesn't have a trailing extension, this just adds extension to the end.

p.setExtension('path/to/foo.dart', '.js') // -> 'path/to/foo.js'
p.setExtension('path/to/foo.dart.js', '.map')
  // -> 'path/to/foo.dart.map'
p.setExtension('path/to/foo', '.js') // -> 'path/to/foo.js'

Implementation

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