copyWith method

User copyWith({
  1. String? gender,
  2. Name? name,
  3. Location? location,
  4. String? username,
  5. String? password,
  6. String? salt,
  7. String? md5,
  8. String? sha1,
  9. String? sha256,
  10. num? registered,
  11. num? dob,
  12. String? phone,
  13. String? cell,
  14. String? pps,
  15. Picture? picture,
})

It creates a new User object with the same values as the current User object, but with the values of the parameters replacing the values of the current User object.

Args: gender (String): The gender of the user. name (Name): The name of the user. location (Location): Location? location, username (String): The username of the user. password (String): password ?? this.password, salt (String): A random string of characters used as an additional input to a one-way function that hashes a password. md5 (String): The md5 hash of the user's email address. sha1 (String): String? sha256 (String): sha256 ?? this.sha256, registered (num): The date the user registered. dob (num): date of birth phone (String): The user's phone number. cell (String): The user's cell phone number. pps (String): Personal Public Service Number picture (Picture): picture ?? this.picture,

Returns: A new User object with the updated values.

Implementation

User copyWith({
  String? gender,
  Name? name,
  Location? location,
  String? username,
  String? password,
  String? salt,
  String? md5,
  String? sha1,
  String? sha256,
  num? registered,
  num? dob,
  String? phone,
  String? cell,
  String? pps,
  Picture? picture,
}) {
  return User(
    gender: gender ?? this.gender,
    name: name ?? this.name,
    location: location ?? this.location,
    username: username ?? this.username,
    password: password ?? this.password,
    salt: salt ?? this.salt,
    md5: md5 ?? this.md5,
    sha1: sha1 ?? this.sha1,
    sha256: sha256 ?? this.sha256,
    registered: registered ?? this.registered,
    dob: dob ?? this.dob,
    phone: phone ?? this.phone,
    cell: cell ?? this.cell,
    pps: pps ?? this.pps,
    picture: picture ?? this.picture,
  );
}