google / google/built_value.dart
Generate field names as strings similar to C# nameof operator
- Dominant language
- Dart
- Stars
- 886
- Forks
- 195
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 4
Description
I would like to ask you to consider adding functionality that would generate field names to strings that would be accessible as static members of a class or an enum.
For example I am using [reactive_forms](https://pub.dev/packages/reactive_forms) package. When defining formgroup object, I have to use string literals for map keys which creates room for errors.
```
FormGroup({
'name': FormControl(),
'email': FormControl(),
});
```
I would much rather have something like this (static class members):
```
FormGroup({
User.fields.name: FormControl(),
User.fields.email: FormControl(),
});
```
or enum style:
```
FormGroup({
UserFields.name.name: FormControl(),
UserFields.email.name: FormControl(),
});
```
This would be useful for many more use cases, but this is the main for me.
Thank you for developing this wonderful library!
Contributor guide
Assessment
This issue has not been assessed yet.