getProcessor static method

ErrorProcessor? getProcessor(
  1. AnalysisOptions? analysisOptions,
  2. AnalysisError error
)

Return an error processor associated in the analysisOptions for the given error, or null if none is found.

Implementation

static ErrorProcessor? getProcessor(
    AnalysisOptions? analysisOptions, AnalysisError error) {
  if (analysisOptions == null) {
    return null;
  }

  // Let the user configure how specific errors are processed.
  List<ErrorProcessor> processors = analysisOptions.errorProcessors;

  // Add the strong mode processor.
  processors = processors.toList();
  for (var processor in processors) {
    if (processor.appliesTo(error)) {
      return processor;
    }
  }
  return null;
}