toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = id;
  data['date_created'] = dateCreated;
  data['date_created_gmt'] = dateCreatedGmt;
  data['date_modified'] = dateModified;
  data['date_modified_gmt'] = dateModifiedGmt;
  data['email'] = email;
  data['first_name'] = firstName;
  data['last_name'] = lastName;
  data['role'] = role;
  data['username'] = username;
  if (billing != null) {
    data['billing'] = billing!.toJson();
  }
  if (shipping != null) {
    data['shipping'] = shipping!.toJson();
  }
  data['is_paying_customer'] = isPayingCustomer;
  data['avatar_url'] = avatarUrl;
  if (metaData != null) {
    data['meta_data'] = metaData!.map((v) => v.toJson()).toList();
  }
  if (links != null) {
    data['_links'] = links!.toJson();
  }
  return data;
}