get method

Module? get(
  1. String integrity
)

Look up a module by its integrity hash. Returns null if not in cache.

Implementation

Module? get(String integrity) {
  final path = _pathForHash(integrity);
  if (path == null) return null;
  final file = File(path);
  if (!file.existsSync()) return null;
  try {
    return Module.fromBuffer(file.readAsBytesSync());
  } catch (_) {
    return null;
  }
}