toString method

  1. @override
String toString()
override

Returns a concise summary of the conversion failure.

Implementation

@override
String toString() {
  final method = context['method'];
  final targetType = context['targetType'];
  final objectType = context['objectType'];
  final mapKey = context['mapKey'];
  final listIndex = context['listIndex'];
  final details = <String>[
    if (method != null) 'method=$method',
    if (targetType != null) 'targetType=$targetType',
    if (objectType != null) 'objectType=$objectType',
    if (mapKey != null) 'mapKey=$mapKey',
    if (listIndex != null) 'listIndex=$listIndex',
  ];
  final suffix = details.isEmpty ? '' : ' (${details.join(', ')})';
  return 'ConversionException($errorType): $error$suffix';
}