toJson method

Map<String, Object> toJson()

Converts a NodeConfigStatus instance to JSON data.

Implementation

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

  final tempActive = active;
  final tempAssigned = assigned;
  final tempError = error;
  final tempLastKnownGood = lastKnownGood;

  if (tempActive != null) {
    jsonData['active'] = tempActive.toJson();
  }

  if (tempAssigned != null) {
    jsonData['assigned'] = tempAssigned.toJson();
  }

  if (tempError != null) {
    jsonData['error'] = tempError;
  }

  if (tempLastKnownGood != null) {
    jsonData['lastKnownGood'] = tempLastKnownGood.toJson();
  }

  return jsonData;
}