google / google/built_value.dart

Non nullable field with Built type is not enforced

Open
#1,088 1 comment 0 reactions 1 assignee Claimed by @davidmorgan View on GitHub
question
Dominant language
Dart
Stars
886
Forks
195
Avg merge
1d 11h
Merged PRs (30d)
4

Description

The following assertion fails (doesn't throw)

```dart
expect(
() => Foo(),
throwsA(isA()),
reason: 'Should fail without required bar param',
);
```
```dart
abstract class Foo implements Built {
Bar get bar;
}

abstract class Bar implements Built {}
```

It also fails on deserialization, when bar is null in the serialized input.

It passes, when the `Foo` is annotated with `@BuiltValue(autoCreateNestedBuilders: false)` but I'd like that as `true`. Would there be any other way?

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.