getHandler method

SourceHandler? getHandler(
  1. ModelSource source
)

Finds the appropriate handler for the given source

Returns the first handler that supports the source type. Order matters - handlers are checked in registration order.

Throws UnsupportedError if no handler supports the source.

Implementation

SourceHandler? getHandler(ModelSource source) {
  for (final handler in handlers) {
    if (handler.supports(source)) {
      return handler;
    }
  }
  throw UnsupportedError('No handler found for source type: ${source.runtimeType}');
}