SchemaReadException constructor

SchemaReadException({
  1. String? entity,
  2. required String fieldName,
  3. required Type expectedType,
  4. Object? actualValue,
  5. Object? cause,
})

Implementation

SchemaReadException({
  this.entity,
  required this.fieldName,
  required this.expectedType,
  this.actualValue,
  this.cause,
}) : super(
        code: DatumExceptionCode.schemaMismatch,
        message: 'Failed to read field "$fieldName"'
            '${entity != null ? ' of $entity' : ''}: expected $expectedType, '
            'got ${actualValue == null ? 'null' : '${actualValue.runtimeType} ($actualValue)'}'
            '${cause != null ? ' — $cause' : ''}',
        details: {
          'field': fieldName,
          'expectedType': expectedType.toString(),
          if (entity != null) 'entity': entity,
          if (actualValue != null) 'actualValue': actualValue.toString(),
          if (cause != null) 'cause': cause.toString(),
        },
      );