toJson method
Converts to a JSON map for the request.
For PUT requests, policy is placed at the top level (unlike
data[policy] in POST).
Implementation
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
if (alerts != null) {
data['alerts'] = alerts!.toJson();
}
final json = <String, dynamic>{'data': data};
if (policy != null) {
json['policy'] = policy;
}
return json;
}