toJson method

Map<String, dynamic> toJson()

Produces a Map that can be serialized to JSON.

Implementation

Map<String, dynamic> toJson() {
  return {
    'type': type,
    if (description != null) 'description': description,
    if (helpLink != null) 'help_link': helpLink,
    if (handled != null) 'handled': handled,
    if (_meta?.isNotEmpty ?? false) 'meta': _meta,
    if (_data?.isNotEmpty ?? false) 'data': _data,
    if (synthetic != null) 'synthetic': synthetic,
    if (isExceptionGroup != null) 'is_exception_group': isExceptionGroup,
    if (source != null) 'source': source,
    if (exceptionId != null) 'exception_id': exceptionId,
    if (parentId != null) 'parent_id': parentId,
  };
}