copyWith method

SharedUser copyWith({
  1. int? userId,
  2. String? firstName,
  3. String? lastName,
  4. String? username,
  5. Photo? photo()?,
})

Returns a copy with the given fields replaced. For a nullable field pass a function, e.g. field: () => null to clear it.

Implementation

SharedUser copyWith({
  int? userId,
  String? firstName,
  String? lastName,
  String? username,
  Photo? Function()? photo,
}) => SharedUser(
  userId: userId ?? this.userId,
  firstName: firstName ?? this.firstName,
  lastName: lastName ?? this.lastName,
  username: username ?? this.username,
  photo: photo != null ? photo() : this.photo,
);