toJson method

Map<String, Object> toJson()

Converts a StatusDetails instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempCauses = causes;
  final tempGroup = group;
  final tempKind = kind;
  final tempName = name;
  final tempRetryAfterSeconds = retryAfterSeconds;
  final tempUid = uid;

  if (tempCauses != null) {
    jsonData['causes'] =
        tempCauses.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempGroup != null) {
    jsonData['group'] = tempGroup;
  }

  if (tempKind != null) {
    jsonData['kind'] = tempKind;
  }

  if (tempName != null) {
    jsonData['name'] = tempName;
  }

  if (tempRetryAfterSeconds != null) {
    jsonData['retryAfterSeconds'] = tempRetryAfterSeconds;
  }

  if (tempUid != null) {
    jsonData['uid'] = tempUid;
  }

  return jsonData;
}