Data.fromJson constructor

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

Implementation

Data.fromJson(Map<String, dynamic> json) {
  userId = json['user_id'];
  userToken = json['user_token'];
  expiry = json['expiry'];
  if (json.containsKey('email')) {
    email = json['email'];
  }
  if (json.containsKey('username')) {
    username = json['username'];
  }
  if (json.containsKey('first_name')) {
    firstName = json['first_name'];
  }
  if (json.containsKey('last_name')) {
    lastName = json['last_name'];
  }
  if (json.containsKey('avatar')) {
    avatar = json['avatar'];
  }
  if (json.containsKey('created_at')) {
    createdAt = json['created_at'];
  }
}