DefaultClassPathResource constructor

DefaultClassPathResource(
  1. String packageUri
)

Implementation

DefaultClassPathResource(super.packageUri) {
  _declarations.addAll(Runtime.getAllClasses().where((c) => _matches(c.getPackageUri())));
  _declarations.addAll(Runtime.getAllEnums().where((c) => _matches(c.getPackageUri())));
  _declarations.addAll(Runtime.getAllMixins().where((c) => _matches(c.getPackageUri())));
  _declarations.addAll(Runtime.getAllRecords().where((c) => _matches(c.getPackageUri())));
  _declarations.addAll(Runtime.getAllTypedefs().where((c) => _matches(c.getPackageUri())));

  final lib = Runtime.getAllLibraries().find((l) => l.getSourceLocation() != null && _matches(l.getSourceLocation()!.toString()));
  if(lib == null) {
    throw _throwIfNotFound();
  }

  _methodDeclarations = lib.getDeclarations().whereType<MethodDeclaration>().toList();
  _library = lib;

  _readSourceCodeAsStream(lib.getSourceLocation() ?? Uri.parse(packageUri));
}