CopyWith

The copyWith method is used to clone a modddel with different values. The resulting modddel is completely independent from the cloned one, and is validated (± sanitized) separately.

/// This is our Modddel
final book = Book(
  id: '#1',
  title: 'The adventures of Dash',
);

final otherBook = book.copyWith(
  title: 'The mistery of Dash',
);

The copyWith method supports assigning null to a value.