diff --git a/built_value_generator/lib/src/dart_types.dart b/built_value_generator/lib/src/dart_types.dart index a4f66e48..f485ebe0 100644 --- a/built_value_generator/lib/src/dart_types.dart +++ b/built_value_generator/lib/src/dart_types.dart @@ -113,7 +113,7 @@ class DartTypes { } else if (dartType is TypeParameterType) { return dartType.element.name + suffix; } else if (dartType is RecordType) { - return dartType.getDisplayString(withNullability: false); + return dartType.getDisplayString(); } else if (dartType is VoidType) { return 'void'; } else if (dartType.isBottom) { diff --git a/built_value_generator/lib/src/enum_source_class.dart b/built_value_generator/lib/src/enum_source_class.dart index ab37f41c..beb377fe 100644 --- a/built_value_generator/lib/src/enum_source_class.dart +++ b/built_value_generator/lib/src/enum_source_class.dart @@ -12,8 +12,7 @@ import 'package:built_value_generator/src/dart_types.dart'; import 'package:built_value_generator/src/enum_source_field.dart'; import 'package:built_value_generator/src/parsed_library_results.dart'; import 'package:built_value_generator/src/strings.dart'; -import 'package:collection/collection.dart' - show IterableExtension, IterableNullableExtension; +import 'package:collection/collection.dart' show IterableExtension; import 'library_elements.dart'; @@ -114,7 +113,7 @@ abstract class EnumSourceClass valuesIdentifier, valueOfIdentifier, for (var field in fields) field.generatedIdentifier, - ].whereNotNull().toList(); + ].nonNulls.toList(); } static bool needsEnumClass(ClassElement classElement) { diff --git a/built_value_generator/lib/src/fields.dart b/built_value_generator/lib/src/fields.dart index 0129fd19..2d86565f 100644 --- a/built_value_generator/lib/src/fields.dart +++ b/built_value_generator/lib/src/fields.dart @@ -57,7 +57,7 @@ BuiltList _fieldElementsForType(InterfaceType type) { var result = ListBuilder(); for (var accessor in type.accessors) { if (accessor.isSetter) continue; - result.add(accessor.variable as FieldElement); + result.add(accessor.variable2 as FieldElement); } return result.build(); } diff --git a/built_value_generator/lib/src/serializer_source_library.dart b/built_value_generator/lib/src/serializer_source_library.dart index e74f88a2..484b0831 100644 --- a/built_value_generator/lib/src/serializer_source_library.dart +++ b/built_value_generator/lib/src/serializer_source_library.dart @@ -47,7 +47,7 @@ abstract class SerializerSourceLibrary .toList(); for (var accessor in accessors) { - final annotations = accessor.variable.metadata + final annotations = accessor.variable2!.metadata .where((annotation) => DartTypes.tryGetName(annotation.computeConstantValue()?.type) == 'SerializersFor') @@ -72,7 +72,7 @@ abstract class SerializerSourceLibrary .toList(); for (var accessor in accessors) { - final annotations = accessor.variable.metadata + final annotations = accessor.variable2!.metadata .where((annotation) => DartTypes.tryGetName(annotation.computeConstantValue()?.type) == 'SerializersFor') diff --git a/built_value_generator/lib/src/value_source_class.dart b/built_value_generator/lib/src/value_source_class.dart index 12f9a0b5..eaa3fc96 100644 --- a/built_value_generator/lib/src/value_source_class.dart +++ b/built_value_generator/lib/src/value_source_class.dart @@ -364,7 +364,7 @@ abstract class ValueSourceClass // Check for any `toString` implementation apart from the one defined on // `Object`. var method = element.lookUpConcreteMethod('toString', element.library)!; - var clazz = method.enclosingElement; + var clazz = method.enclosingElement3; return clazz is! ClassElement || clazz.name != 'Object'; } diff --git a/built_value_generator/pubspec.yaml b/built_value_generator/pubspec.yaml index 6728835b..2f1173f4 100644 --- a/built_value_generator/pubspec.yaml +++ b/built_value_generator/pubspec.yaml @@ -10,10 +10,10 @@ topics: - build-runner environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.6.0-edge <4.0.0' dependencies: - analyzer: '>=5.2.0 <7.0.0' + analyzer: '>=6.9.0 <7.0.0' build: '>=1.0.0 <3.0.0' build_config: '>=0.3.1 <2.0.0' built_collection: ^5.0.0