Skip to content

Dart is missing &&= and ||= operators #25264

Closed
@Hixie

Description

@Hixie

It's really useful to be able to write code like:

    result.canTap ||= onCanTap != null;
    result.canDoubleTap ||= onDoubleTap != null;
    result.canLongPress ||= onLongPress != null;

...but currently we can't because ||= and &&= don't work in Dart. |= and &= work, but | and & aren't implemented by bool so that doesn't help here.

Metadata

Metadata

Assignees

Labels

area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions