Data.fromJson constructor

Data.fromJson(
  1. Map<String, dynamic> json
)

Implementation

Data.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  firstName = json['first_name'];
  lastName = json['last_name'];
  username = json['username'];
  userNicename = json['user_nicename'];
  displayName = json['display_name'];
  userStatus = json['user_status'];
  email = json['email'];
  roles = [];
  if (json['roles'] != null) {
    (json['roles'] as List).forEach((role) {
      roles!.add(role);
    });
  }
  avatar = json['avatar'];
  if (json['meta_data'] != null && Map.of(json['meta_data']).isNotEmpty) {
    this.metaData = [];
    Map.from(json['meta_data']).forEach((key, value) {
      this.metaData!.add(MetaData.fromJson(key, value));
    });
  }
  createdAt = json['created_at'];
}