toJson method

  1. @override
Map<String, dynamic> toJson()

Returns the stored information about this PolicyEntry in a Map which could be directly used to creates a json entry.

Stores id and _groups in the Map.

Implementation

@override
Map<String, dynamic> toJson() {
  final Map<String, dynamic> newJson = <String, dynamic>{};
  newJson[DittoKeys.policyId] = id;
  if (_groups.isNotEmpty) {
    final Map<String, dynamic> gro = _groups.map<String, dynamic>(
        (String key, PolicyGroup value) =>
            MapEntry<String, dynamic>(key, value.toJson()));
    newJson[DittoKeys.entries] = gro;
  }
  return newJson;
}