deflectPackage method Null safety

  1. @override
void deflectPackage(
  1. Directory destinationDirectory

Modifies a package on the filesystem in order to remove dart:mirrors from the package.

A copy of this compiler's package will be written to destinationDirectory. This method is overridden to modify the contents of that directory to remove all uses of dart:mirrors.

Packages should export their Compiler in their main library file and only import mirrors in files directly or transitively imported by the Compiler file. This method should remove that export statement and therefore remove all transitive mirror imports.


void deflectPackage(Directory destinationDirectory) {
  final libFile = File.fromUri(
  final contents = libFile.readAsStringSync();
      contents.replaceFirst("export 'src/compiler.dart';", ""));