Skip to content

Commit

Permalink
Remove use of deprecated @nullable from docs and comments. (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmorgan authored Dec 19, 2024
1 parent 5ed844f commit a44864f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
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

0 comments on commit a44864f

Please sign in to comment.