User.fromMap constructor

User.fromMap(
  1. Map<String, dynamic> map
)

It creates a User object from a map.

Args: map (Map<String, dynamic>): The map that contains the data to be converted to a User object.

Returns: A User object

Implementation

factory User.fromMap(Map<String, dynamic> map) {
  return User(
    gender: map['gender'] != null ? map['gender'] as String : null,
    name: map['name'] != null
        ? Name.fromMap(map['name'] as Map<String, dynamic>)
        : null,
    location: map['location'] != null
        ? Location.fromMap(map['location'] as Map<String, dynamic>)
        : null,
    username: map['username'] != null ? map['username'] as String : null,
    password: map['password'] != null ? map['password'] as String : null,
    salt: map['salt'] != null ? map['salt'] as String : null,
    md5: map['md5'] != null ? map['md5'] as String : null,
    sha1: map['sha1'] != null ? map['sha1'] as String : null,
    sha256: map['sha256'] != null ? map['sha256'] as String : null,
    registered: map['registered'] != null ? map['registered'] as num : null,
    dob: map['dob'] != null ? map['dob'] as num : null,
    phone: map['phone'] != null ? map['phone'] as String : null,
    cell: map['cell'] != null ? map['cell'] as String : null,
    pps: map['PPS'] != null ? map['PPS'] as String : null,
    picture: map['picture'] != null
        ? Picture.fromMap(map['picture'] as Map<String, dynamic>)
        : null,
  );
}