AnalysisError class
An error discovered during the analysis of some Dart code.
See AnalysisErrorListener
.
- Implemented types
Constructors
-
AnalysisError(Source source, int offset, int length, ErrorCode errorCode, [List<
Object?> ? arguments, List<DiagnosticMessage> contextMessages = const [], Object? data]) -
Initialize a newly created analysis error. The error is associated with
the given
source
and is located at the givenoffset
with the givenlength
. The error will have the givenerrorCode
and the list ofarguments
will be used to complete the message and correction. If anycontextMessages
are provided, they will be recorded with the error.factory -
AnalysisError.forValues({required Source source, required int offset, required int length, required ErrorCode errorCode, required String message, String? correctionMessage, List<
DiagnosticMessage> contextMessages = const [], Object? data}) - Initialize a newly created analysis error with given values.
-
AnalysisError.tmp({required Source source, required int offset, required int length, required ErrorCode errorCode, List<
Object?> arguments = const [], List<DiagnosticMessage> contextMessages = const [], Object? data}) -
Initialize a newly created analysis error. The error is associated with
the given
source
and is located at the givenoffset
with the givenlength
. The error will have the givenerrorCode
and the list ofarguments
will be used to complete the message and correction. If anycontextMessages
are provided, they will be recorded with the error.
Properties
-
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.
no setteroverride
- 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.no setter - correctionMessage → String?
-
A description of how to fix the problem, or
null
if there is no such description.no setteroverride - data → Object?
-
Data associated with this error, specific for errorCode.
final
- errorCode → ErrorCode
-
The error code associated with the error.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- length → int
-
The number of characters from the offset to the end of the source which
encompasses the compilation error.
no setter
- message → String
-
Return the message to be displayed for this error. The message should
indicate what is wrong and why it is wrong.
no setter
- offset → int
-
The character offset from the beginning of the source (zero based) where
the error occurred.
no setter
- problemMessage → DiagnosticMessage
-
A message describing what is wrong and why.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- severity → Severity
-
The severity associated with the diagnostic.
no setteroverride
- source → Source
-
The source in which the error occurred, or
null
if unknown.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
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.
getter/setter pair
-
FILE_COMPARATOR
↔ Comparator<
AnalysisError> -
A Comparator that sorts by the name of the file that the AnalysisError
was found.
getter/setter pair
Static Methods
-
mergeLists(
List< List< errorLists) → List<AnalysisError> >AnalysisError> -
Merge all of the errors in the lists in the given list of
errorLists
into a single list of errors.
Constants
-
NO_ERRORS
→ const List<
AnalysisError> - An empty array of errors used when no errors are expected.