JsonParsingException class
An exception that occurs during JSON parsing.
This exception is thrown when there is an error in parsing a JSON string into a Dart object, or when a Dart object cannot be serialized into a JSON string.
Example
void parseJson(String json) {
try {
final object = jsonDecode(json);
} catch (e) {
throw JsonParsingException("Failed to parse JSON", cause: e);
}
}
Constructors
- JsonParsingException(String message, {Object? cause})
- An exception that occurs during JSON parsing.
Properties
- cause → Object?
-
The underlying cause of this exception, if any.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
The message describing the error.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace
-
The associated stack trace.
finalinherited
Methods
-
getCause(
) → Object -
The cause of this exception, if any.
inherited
-
getMessage(
) → String -
The message associated with this exception.
inherited
-
getStackTrace(
) → StackTrace -
The stack trace associated with this exception.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited