toJson method

Map<String, Object> toJson()

Converts a SELinuxOptions instance to JSON data.

Implementation

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

  final tempLevel = level;
  final tempRole = role;
  final tempType = type;
  final tempUser = user;

  if (tempLevel != null) {
    jsonData['level'] = tempLevel;
  }

  if (tempRole != null) {
    jsonData['role'] = tempRole;
  }

  if (tempType != null) {
    jsonData['type'] = tempType;
  }

  if (tempUser != null) {
    jsonData['user'] = tempUser;
  }

  return jsonData;
}