google / google/built_value.dart

Generate onSet for non-instantiable Built Value

Open
#940 2 comments 0 reactions 1 assignee Claimed by @davidmorgan View on GitHub
p2 / feature request
Dominant language
Dart
Stars
886
Forks
195
Avg merge
1d 11h
Merged PRs (30d)
4

Description

I am not sure if this is a legit request but onSet field can be generated for non-instantiable Built Value classes.
I tried to something like the following:
```dart
@BuiltValue(generateBuilderOnSetField: true, instantiable: false)
abstract class Thing extends Object {
Thing rebuild(void Function(ThingBuilder) updates);
ThingBuilder toBuilder();

@nullable
String get thingName;
}
```

This does not work:
```dart
thingController = StreamController();
thingStream = Stream(thingController.stream);
thingBuilder = thing.toBuilder();
thingBuilder.onSet = thingController.add as void Function(); // this does not work. onSet isn't defined.
```

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.