toMap method
Convert to a Map (e.g., for JSON serialization).
Implementation
Map<String, dynamic> toMap({bool includeStackTrace = false}) {
return {
'type': type,
'title': title,
'status': statusCode,
if (message != null) 'detail': message,
if (instance != null) 'instance': instance,
if (details != null) 'details': details,
...extensions,
if (includeStackTrace && stackTrace != null)
'stack_trace': stackTrace.toString(),
};
}