toJson method

Map<String?, dynamic>? toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> json = <String, dynamic>{
    'requestAgent': 'flutter-alpha',
  };

  if (keywords != null && keywords.isNotEmpty) {
    assert(keywords.every((String s) => s != null && s.isNotEmpty));
    json['keywords'] = keywords;
  }
  if (nonPersonalizedAds != null)
    json['nonPersonalizedAds'] = nonPersonalizedAds;
  if (contentUrl != null && contentUrl.isNotEmpty)
    json['contentUrl'] = contentUrl;
  if (birthday != null) json['birthday'] = birthday.millisecondsSinceEpoch;
  if (gender != null) json['gender'] = gender.index;
  if (designedForFamilies != null)
    json['designedForFamilies'] = designedForFamilies;
  if (childDirected != null) json['childDirected'] = childDirected;
  if (testDevices != null && testDevices.isNotEmpty) {
    assert(testDevices.every((String s) => s != null && s.isNotEmpty));
    json['testDevices'] = testDevices;
  }

  return json;
}