copyWith abstract method
T
copyWith()
Creates a new instance of the model T with updated properties.
Subclasses must implement this method, providing specific named, optional parameters for each field that can be copied/updated.
Example for a User model:
@override
User copyWith({String? name, int? age}) {
return User(
name: name ?? this.name,
age: age ?? this.age,
// other fields...
);
}
Implementation
T copyWith();