I have classes defined in individual files. I want to store all of the classes in a single Hive box. I cannot see how to register the adapters for the separate files and have them generated into a single .part file. Do I need to create a method and explicitly call the method to register the adapters? I've tried registering them in the Main() method of main file, but that doesn't work. After running build_runner, the additional adapters are not in the .part file.
CLASS A
import 'package:hive/hive.dart';
import 'package:my_project/class_b.dart';
import 'package:my_project/class_c.dart';
...
@HiveType(typeId: 0)
class ClassA {
@HiveField(0)
String string ="";
...
void main(List<String> arguments) async {
var path = "assets/";
Hive
..registerAdapter(ClassAAdapter());
..registerAdapter(ClassBAdapter()); //???
...
}
CLASS B
import 'package:hive/hive.dart';
...
@HiveType(typeId: 1)
class ClassB {
@HiveField(0)
String string ="";
...
void initAdapters() { //???
var path = "assets/";
Hive // ??????
..registerAdapter(ClassBAdapter()); //???
}