CopyWithModel mixin
Mixin that documents the copyWith pattern for models.
Models can use this mixin to indicate they follow the copyWith pattern for creating modified copies of themselves.
class MyModel with CopyWithModel implements Model {
final int count;
final String name;
MyModel({this.count = 0, this.name = ''});
MyModel copyWith({int? count, String? name}) {
return MyModel(
count: count ?? this.count,
name: name ?? this.name,
);
}
// ... implement init, update, view
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited