anchor.diff:    }
   
     bool _isPackageReference(SourceReference reference) {
  -    var source = reference.element.source!;
  -    var quotedImportUri = source.contents.data.substring(reference.range.offset,
  +    var unitSourceContent = reference.element.unitSourceContent;
  +    if (unitSourceContent == null) {
  +      return false;
  +    }
  +    var quotedImportUri = unitSourceContent.substring(reference.range.offset,
           reference.range.offset + reference.range.length);
       return packagePrefixedStringPattern.hasMatch(quotedImportUri);
     }
  
positive.code: import 'package:analysis_server/src/services/refactoring/refactoring_internal.dart';
  import 'package:analyzer/dart/analysis/results.dart';
  import 'package:analyzer/dart/ast/ast.dart';
  import 'package:analyzer/file_system/file_system.dart';
  import 'package:analyzer/src/dart/analysis/driver.dart';
  import 'package:analyzer/src/generated/source.dart';
  import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
  import 'package:analyzer_plugin/utilities/range_factory.dart';
  
negative.code:     }
    }
  }
  
  extension on Element {
    String? get unitSourceContent {
      var unitElement = thisOrAncestorOfType<CompilationUnitElementImpl>();
      return unitElement?.sourceContent;
    }
  }
  