outputPathFor method

  1. @override
Uri outputPathFor(
  1. Uri inputPath,
  2. String extension
)

Returns the path where the .pb.dart file will be placed.

The input is a .proto file and the output is a path under the output folder.

Implementation

@override
Uri outputPathFor(Uri inputPath, String extension) {
  final pkg = _findPackage(inputPath.path);
  if (pkg == null) {
    throw ArgumentError('Unable to locate package for input $inputPath.');
  }

  // Bazel package-relative paths.
  final relativeInput = inputPath.path.substring('${pkg.inputRoot}/'.length);
  final base = p.withoutExtension(relativeInput);
  final outputPath = p.join(pkg.outputRoot, '$base$extension');
  return Uri.file(outputPath);
}