toJson method

Map<String, dynamic> toJson (
  1. {bool includePhoto: false,
  2. bool includeNormalizedNumber: true}
)

Implementation

Map<String, dynamic> toJson({
  bool includePhoto = false,
  bool includeNormalizedNumber = true,
}) {
  var json = _$ContactToJson(this);
  // photo requires special handling since it's ignored by json serialization
  if (includePhoto) json['photo'] = photo;
  if (!includeNormalizedNumber) {
    for (var i = 0; i < json['phones'].length; ++i) {
      json['phones'][i]['normalizedNumber'] = '';
    }
  }
  return json;
}