Skip to content

Commit

Permalink
Require 'analyzer 6.9.0+' and SDK 3.6.0-edge (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
scheglov authored Sep 24, 2024
1 parent 153e6ba commit 3e0c8b8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion built_value_generator/lib/src/dart_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions built_value_generator/lib/src/enum_source_class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion built_value_generator/lib/src/fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ BuiltList<FieldElement> _fieldElementsForType(InterfaceType type) {
var result = ListBuilder<FieldElement>();
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();
}
4 changes: 2 additions & 2 deletions built_value_generator/lib/src/serializer_source_library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion built_value_generator/lib/src/value_source_class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
4 changes: 2 additions & 2 deletions built_value_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3e0c8b8

Please sign in to comment.