getByType method

Resource? getByType(
  1. Type type
)

Gets a resource by runtime Type.

Returns null if the type is not registered or the resource is absent. Same as get but accepts a runtime Type instead of a generic parameter.

Implementation

Resource? getByType(final Type type) {
  ensureFlushed();
  final resourceId = _typeToId[type];
  if (resourceId == null) return null;
  if (!resourceId.isValid || resourceId.value >= _resources.length) {
    return null;
  }
  return _resources[resourceId.value];
}