copyWith method

User copyWith({
  1. String? id,
  2. String? name,
  3. DateTime? createdAt,
})

Creates a copy of this User with the given fields replaced

Implementation

User copyWith({
  String? id,
  String? name,
  DateTime? createdAt,
}) {
  return User(
    id: id ?? this.id,
    name: name ?? this.name,
    createdAt: createdAt ?? this.createdAt,
  );
}