CodableException.unsupportedMethod constructor
Throws an UnsupportedError with the message "Unsupported method: 'Class.method()'". The message will include a reason if provided.
It should primarily be used by a Decoder implementation when a decoding method is called that is not supported.
For example, when calling decodeList
on CsvDecoder, the error would read
"Unsupported operation: 'CsvDecoder.decodeList()'. The csv format does not support nested lists.".
The clazz
parameter is the class name.
The method
parameter is the method name.
The reason
parameter is an optional reason for why the method is not supported.
Implementation
factory CodableException.unsupportedMethod(String clazz, String method, {Object? reason}) {
var message = "'$clazz.$method()'";
if (reason != null) {
message += '. $reason';
}
return CodableUnsupportedError(message);
}