Skip to content

Commit 89c4c42

Browse files
authored
fix(odm): replace deprecated elements from analyzer (#9366)
1 parent 2937fb8 commit 89c4c42

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/collection_generator.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class CollectionGenerator extends ParserGenerator<void, Data, Collection> {
233233
final type = (object.type! as ParameterizedType).typeArguments.first;
234234

235235
final hasJsonSerializable = const TypeChecker.fromRuntime(JsonSerializable)
236-
.hasAnnotationOf(type.element!);
236+
.hasAnnotationOf(type.element2!);
237237

238238
if (type.isDynamic) {
239239
throw InvalidGenerationSourceError(
@@ -243,7 +243,7 @@ class CollectionGenerator extends ParserGenerator<void, Data, Collection> {
243243
);
244244
}
245245

246-
final collectionTargetElement = type.element;
246+
final collectionTargetElement = type.element2;
247247
if (collectionTargetElement is! ClassElement) {
248248
throw InvalidGenerationSourceError(
249249
'The annotation @Collection can only receive classes as generic argument. ',
@@ -405,10 +405,10 @@ extension on String {
405405

406406
extension on DartType {
407407
bool get isJsonDocumentReference {
408-
return element?.librarySource?.uri.scheme == 'package' &&
408+
return element2?.librarySource?.uri.scheme == 'package' &&
409409
const {'cloud_firestore'}
410-
.contains(element?.librarySource?.uri.pathSegments.first) &&
411-
element?.name == 'DocumentReference' &&
410+
.contains(element2?.librarySource?.uri.pathSegments.first) &&
411+
element2?.name == 'DocumentReference' &&
412412
(this as InterfaceType).typeArguments.single.isDartCoreMap;
413413
}
414414

packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/templates/query_reference.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ class ${data.queryReferenceImplName}
406406

407407
extension on TypeProvider {
408408
DartType asNullable(DartType type) {
409-
final typeSystem = nullType.element.library.typeSystem;
409+
final typeSystem = nullType.element2.library.typeSystem;
410410
if (typeSystem.isNullable(type)) return type;
411411

412412
return typeSystem.leastUpperBound(type, nullType);

packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/validator_generator.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ bool isValidatorAnnotation(ElementAnnotation annotation) {
3636
final element = annotation.element;
3737
if (element == null || element is! ConstructorElement) return false;
3838

39-
return element.enclosingElement2.allSupertypes.any((superType) {
40-
return superType.element.name == 'Validator' &&
41-
superType.element.librarySource.uri.toString() ==
39+
return element.enclosingElement3.allSupertypes.any((superType) {
40+
return superType.element2.name == 'Validator' &&
41+
superType.element2.librarySource.uri.toString() ==
4242
'package:cloud_firestore_odm/src/validator.dart';
4343
});
4444
}

0 commit comments

Comments
 (0)