Skip to content

Commit

Permalink
Migration for analyzer 6.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexios80 committed Jul 6, 2024
1 parent 980f3e1 commit 81b720d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 28 deletions.
1 change: 1 addition & 0 deletions hive/lib/hive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:hive_ce/src/object/hive_list_impl.dart';
import 'package:hive_ce/src/object/hive_object.dart';
import 'package:hive_ce/src/util/extensions.dart';
import 'package:meta/meta.dart';
import 'package:meta/meta_meta.dart';

export 'src/box_collection/box_collection_stub.dart'
if (dart.library.js_interop) 'package:hive_ce/src/box_collection/box_collection_indexed_db.dart'
Expand Down
13 changes: 6 additions & 7 deletions hive/lib/src/annotations/hive_field.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
part of '../../hive.dart';

/// Annotate all fields you want to persist with [HiveField].
// TODO: Enable when Flutter supports analyser 6.5.0
// @Target({
// TargetKind.field,
// TargetKind.getter,
// TargetKind.setter,
// TargetKind.enumValue,
// })
@Target({
TargetKind.field,
TargetKind.getter,
TargetKind.setter,
TargetKind.enumValue,
})
class HiveField {
/// The index of this field.
final int index;
Expand Down
4 changes: 1 addition & 3 deletions hive_generator/lib/src/class_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,5 @@ String _suffixFromType(DartType type) {

String _displayString(DartType e) {
final suffix = _suffixFromType(e);
// TODO: Update when Flutter supports analyser 6.5.0
// ignore: deprecated_member_use
return '${e.getDisplayString(withNullability: false)}$suffix';
return '${e.getDisplayString()}$suffix';
}
25 changes: 7 additions & 18 deletions hive_generator/lib/src/type_adapter_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,12 @@ class TypeAdapterGenerator extends GeneratorForAnnotation<HiveType> {
final getters = <AdapterField>[];
final setters = <AdapterField>[];
for (final name in accessorNames) {
// TODO: Update when Flutter supports analyser 6.5.0
// ignore: deprecated_member_use
final getter = cls.lookUpGetter(name, library);
final getter = cls.augmented.lookUpGetter(name: name, library: library);
if (getter != null) {
final getterAnn =
// TODO: Update when Flutter supports analyser 6.5.0
// ignore: deprecated_member_use
getHiveFieldAnn(getter.variable) ?? getHiveFieldAnn(getter);
getHiveFieldAnn(getter.variable2) ?? getHiveFieldAnn(getter);
if (getterAnn != null) {
// TODO: Update when Flutter supports analyser 6.5.0
// ignore: deprecated_member_use
final field = getter.variable;
final field = getter.variable2!;
getters.add(
AdapterField(
getterAnn.index,
Expand All @@ -113,18 +107,13 @@ class TypeAdapterGenerator extends GeneratorForAnnotation<HiveType> {
}
}

// TODO: Update when Flutter supports analyser 6.5.0
// ignore: deprecated_member_use
final setter = cls.lookUpSetter('$name=', library);
final setter =
cls.augmented.lookUpSetter(name: '$name=', library: library);
if (setter != null) {
final setterAnn =
// TODO: Update when Flutter supports analyser 6.5.0
// ignore: deprecated_member_use
getHiveFieldAnn(setter.variable) ?? getHiveFieldAnn(setter);
getHiveFieldAnn(setter.variable2) ?? getHiveFieldAnn(setter);
if (setterAnn != null) {
// TODO: Update when Flutter supports analyser 6.5.0
// ignore: deprecated_member_use
final field = setter.variable;
final field = setter.variable2!;
setters.add(
AdapterField(
setterAnn.index,
Expand Down

0 comments on commit 81b720d

Please sign in to comment.