Skip to content

Cannot copyWith null values #3

Description

@pauldemarco

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions