getResource method

RT? getResource(
  1. String fullName, {
  2. bool reload = false,
})

Try to get a source by a unique key.

Implementation

RT? getResource(String fullName, {bool reload = false}) {
  if (_cachedSources.containsKey(fullName) && !reload) {
    return _cachedSources[fullName]!;
  } else if (isSearchEnabled) {
    for (final root in _contextRoots.keys) {
      if (path.isWithin(root, fullName)) {
        final context = _contextRoots[root]!;
        final normalized = context.getAbsolutePath(key: fullName);
        final source = context.getResource(normalized);
        return source;
      }
    }
  }
  return null;
}