I have transformed my model "note" into hive model in order to store some data with hive. I'm trying to generate model class adapter with command "flutter pub run build_runner build", but it has no effect. Generated file with adapter, which I need, is not created.
Here is my transformed model "note.dart":
import 'package:hive/hive.dart';
part 'note.g.dart';
class Note extends HiveObject{
@HiveType(typeId: 0)
Note({
required this.id,
required this.title,
required this.content,
required this.date,
this.isPinned = false,
this.isChecked = false,
});
@HiveField(0)
late final DateTime id;
@HiveField(1)
late String title;
@HiveField(2)
late String content;
@HiveField(3)
late DateTime date;
@HiveField(4)
bool isPinned;
@HiveField(5)
bool isChecked;
}
Also I'm pasting my dependencies:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
provider: ^6.0.2
intl: ^0.17.0
very_good_analysis: ^1.0.0
hive: ^2.2.2
hive_flutter: ^1.1.0
path_provider: ^2.0.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^2.1.11
hive_generator: ^1.1.3
And the output of command "flutter pub run build_runner build": command output
I hope you can help me somehow.
Thanks!
CodePudding user response:
Move this line @HiveType(typeId: 0)
to the top outside the class