resolve method

T? resolve(
  1. String key, [
  2. C? context
])

Resolves a resource.

Implementation

T? resolve(String key, [C? context]) {
  var options = _resources[key];
  if (isEmptyObject(options)) return defaultResource?.resource;

  context ??= defaultContext;
  if (context == null) {
    return (defaultResource ?? options!.first).resource;
  }

  var sortedOptions = _resourcesSorted.putIfAbsent(key, () {
    var list = options!.toList();
    list.sort();
    return list;
  });

  return _getResource(sortedOptions, context).resource;
}