toJson method

Map<String, dynamic> toJson()

Convert ICalendar object to a Map<String, dynamic> containing all its data, formatted into a valid JSON Map<String, dynamic>.

{
  "version": ICalendar.version,
  "prodid": ICalendar.prodid,
  "data": ICalendar.data
}

Implementation

Map<String, dynamic> toJson() {
  final _map = <String, dynamic>{
    'version': version,
    'prodid': prodid,
  };
  for (final entry in headData.entries) {
    _map[entry.key] = entry.value;
  }
  _map['data'] = data;
  return jsonDecode(jsonEncode(_map, toEncodable: _toEncodable))
      as Map<String, dynamic>;
}