dart-lang / dart-lang/language

Create Auto Properties in Dart

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

Description

[C# has auto properties](https://stackoverflow.com/a/6001941/1227166) which make creating public getters and private setters really easy, like `public string Example { get; private set; }`

I would like to suggest that we have something similar in Dart, like this:

```dart
int get _set count = 5;
```

This code would be equivalent to what we have to do now:

```dart
int _count = 5;
int get count => _count;
```

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.