ModelParsingException class

Exception thrown when JSON parsing fails for a model.

Provides detailed debugging information such as:

  • Model name
  • Field name
  • Expected type
  • Received value
  • Index (if parsing a list)

The message is formatted with ANSI colors for better readability in supported terminals.

Implemented types

Constructors

ModelParsingException({required String modelName, String? fieldName, Type? expectedType, dynamic receivedValue, int? index})
Creates a new ModelParsingException.

Properties

expectedType Type?
The expected Dart type for the field.
final
fieldName String?
The field that caused the parsing error.
final
hashCode int
The hash code for this object.
no setterinherited
index int?
The index if the error occurred inside a list.
final
modelName String
The name of the model that failed to parse.
final
receivedValue → dynamic
The value received from the API.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a formatted error message describing the parsing issue.
override

Operators

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