AnalysisError class

An error discovered during the analysis of some Dart code.

See AnalysisErrorListener.

Implemented types


AnalysisError(Source source, int offset, int length, ErrorCode errorCode, [List<Object> arguments, List<DiagnosticMessage> contextMessages = const []])
Initialize a newly created analysis error. The error is associated with the given source and is located at the given offset with the given length. The error will have the given errorCode and the list of arguments will be used to complete the message and correction. If any contextMessages are provided, they will be recorded with the error.
AnalysisError.forValues(Source source, int offset, int length, ErrorCode errorCode, String message, String _correction, {List<DiagnosticMessage> contextMessages: const []})
Initialize a newly created analysis error with given values.


contextMessages List<DiagnosticMessage>
A list of messages that provide context for understanding the problem being reported. The list will be empty if there are no such messages.
read-only, override
correction String
Return the template used to create the correction to be displayed for this error, or null if there is no correction information for this error. The correction should indicate how the user can fix the error.
correctionMessage String
A description of how to fix the problem, or null if there is no such description.
read-only, override
errorCode ErrorCode
The error code associated with the error.
hashCode int
The hash code for this object. [...]
read-only, override
length int
The number of characters from the offset to the end of the source which encompasses the compilation error.
message String
Return the message to be displayed for this error. The message should indicate what is wrong and why it is wrong.
offset int
The character offset from the beginning of the source (zero based) where the error occurred.
problemMessage DiagnosticMessage
A message describing what is wrong and why.
read-only, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
severity Severity
The severity associated with the diagnostic.
read-only, override
source → Source
The source in which the error occurred, or null if unknown.


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
Returns a string representation of this object.


operator ==(Object other) bool
The equality operator. [...]

Static Properties

ERROR_CODE_COMPARATOR Comparator<AnalysisError>
A Comparator that sorts error codes first by their severity (errors first, warnings second), and then by the error code type.
read / write
FILE_COMPARATOR Comparator<AnalysisError>
A Comparator that sorts by the name of the file that the AnalysisError was found.
read / write

Static Methods

mergeLists(List<List<AnalysisError>> errorLists) List<AnalysisError>
Merge all of the errors in the lists in the given list of errorLists into a single list of errors.


NO_ERRORS → const List<AnalysisError>
An empty array of errors used when no errors are expected.
const <AnalysisError>[]