auto_data icon indicating copy to clipboard operation
auto_data copied to clipboard

Cannot `copyWith` null values

Open pauldemarco opened this issue 7 years ago • 0 comments

Since the copyWith function ignores null input parameters, it is not possible to clear out nullable properties:

final person = person.copyWith(imageUrl: null);
/// This has no effect because of generated copyWith function:
...
Person({
imageUrl: imageUrl ?? this.imageUrl,
...

Propose another generated function called clear:

final person = person.clear(imageUrl: true); // Only properties with @nullable show as parameters

pauldemarco avatar Jan 25 '19 19:01 pauldemarco