ErrorReporter class

An object used to create analysis errors and report then to an error listener.

Constructors

ErrorReporter(AnalysisErrorListener _errorListener, Source _source, {bool isNonNullableByDefault = false})
Initialize a newly created error reporter that will report errors to the given _errorListener. Errors will be reported against the _defaultSource unless another source is provided later.

Properties

hashCode int
The hash code for this object.
no setterinherited
isNonNullableByDefault bool
Is true if the library being analyzed is non-nullable by default.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source → Source
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reportError(AnalysisError error) → void
Report the given error.
reportErrorForElement(ErrorCode errorCode, Element element, [List<Object>? arguments]) → void
Report an error with the given errorCode and arguments. The element is used to compute the location of the error.
reportErrorForName(ErrorCode code, ConstructorDeclaration constructor, {List<Object>? arguments}) → void
Report a diagnostic with the given code and arguments. The location of the diagnostic will be the name of the constructor.
reportErrorForNode(ErrorCode errorCode, AstNode node, [List<Object>? arguments, List<DiagnosticMessage>? messages]) → void
Report an error with the given errorCode and arguments. The node is used to compute the location of the error.
reportErrorForOffset(ErrorCode errorCode, int offset, int length, [List<Object>? arguments, List<DiagnosticMessage>? messages]) → void
Report an error with the given errorCode and arguments. The location of the error is specified by the given offset and length.
reportErrorForSpan(ErrorCode errorCode, SourceSpan span, [List<Object>? arguments]) → void
Report an error with the given errorCode and arguments. The location of the error is specified by the given span.
reportErrorForToken(ErrorCode errorCode, Token token, [List<Object>? arguments, List<DiagnosticMessage>? messages]) → void
Report an error with the given errorCode and arguments. The token is used to compute the location of the error.
reportErrorMessage(ErrorCode errorCode, int offset, int length, Message message) → void
Report an error with the given errorCode and message. The location of the error is specified by the given offset and length.
reportTypeErrorForNode(ErrorCode errorCode, AstNode node, List<Object> arguments) → void
Report an error with the given errorCode and arguments. The node is used to compute the location of the error. The arguments are expected to contain two or more types. Convert the types into strings by using the display names of the types, unless there are two or more types with the same names, in which case the extended display names of the types will be used in order to clarify the message.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited