toResponse method
The 422 body. With CoreFlags.laravelErrors it is
{"message": "...", "errors": {"field": ["..."]}}, else message.
Implementation
@override
dynamic toResponse() {
if (!Dox().flags.laravelErrors) return super.toResponse();
Map<String, List<String>> errors = _allErrors();
List<String> all = <String>[
for (List<String> list in errors.values) ...list,
];
String text = all.isEmpty ? message.toString() : all.first;
int more = all.length - 1;
if (more > 0) text += ' (and $more more error${more == 1 ? '' : 's'})';
return <String, dynamic>{'message': text, 'errors': errors};
}