dart-lang / dart-lang/language

operators to replace "== null" and "!= null"

Open
#190 32 comments 24 reactions 0 assignees View on GitHub
request
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

Dart already provides the beloved and very useful NULL-aware operators ??, ??= and ?.

I'd really like to see operators to replace the tedious "== null" and "!= null" comparisons.

Something along the lines of:
```dart
if (??nullableObject) callFoo();
if (!?nullableObject) callFoo();
```

Contributor guide

Open the contributing guide

Research direction

Review the proposed ??nullableObject and !?nullableObject forms and the issue discussion first. No file, test, or entry point is named; the work is complete only after the desired operators and their behavior are agreed and the relevant Dart language specification updates are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.