decoderForFormatId method
Returns the highest-priority decoder descriptor for formatId, if any.
Implementation
PixaDecoderDescriptor? decoderForFormatId(String formatId) {
final String normalized = _normalizeRouteClaim(formatId);
if (normalized.isEmpty) {
return null;
}
PixaDecoderDescriptor? selected;
for (final PixaDecoderDescriptor decoder in _decoders.values) {
final bool handlesFormat = decoder.formatIds
.map(_normalizeRouteClaim)
.any((String candidate) => candidate == normalized);
if (!handlesFormat) {
continue;
}
if (selected == null || decoder.priority > selected.priority) {
selected = decoder;
}
}
return selected;
}