dart-lang / dart-lang/language

Request: calling a function only when a parameter is not null.

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

Description

It's awkward to call a function when a parameter is not null, such as:

```dart
String toPrint;

if (toPrint != null) {
print(toPrint);
}
```

This is significantly more work than calling a method when the target is not null:

```dart
Printer printer;

printer?.print(toPrint);
```

So naturally we developers have gotten privileged and want both :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.