Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of deprecated @nullable from docs and comments. #1339

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ a client for a JSON API representing a person that looks like the following:

The corresponding dart class employing `built_value` might look like this. Note
that it is using the
[`@nullable`](https://pub.dev/documentation/built_value/latest/built_value/nullable-constant.html)
annotation to indicate that the field does not have to be present on the
response, as well as the
[`@BuiltValueField`](https://pub.dev/documentation/built_value/latest/built_value/BuiltValueField-class.html)
annotation to map between the property name on the response and the name of the
member variable in the `Person` class.
Expand All @@ -224,17 +221,13 @@ part 'person.g.dart';
abstract class Person implements Built<Person, PersonBuilder> {
static Serializer<Person> get serializer => _$personSerializer;

// Can never be null.
int get id;

@nullable
int get age;
int? get age;

@nullable
@BuiltValueField(wireName: 'first_name')
String get firstName;
String? get firstName;

@nullable
BuiltList<String> get hobbies;

Person._();
Expand Down
2 changes: 1 addition & 1 deletion end_to_end_test/test/mixins_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:test/test.dart';
void main() {
group(GetsCorrectFieldsViaMixins, () {
test('has correct fields', () {
// If it has any unwanted fields they will not be @nullable so this will
// If it has any unwanted fields they will not be nullable so this will
// throw.
var value = GetsCorrectFieldsViaMixins((b) => b..shouldBeAField = 1);
expect(value.shouldBeAField, 1);
Expand Down
Loading