0

I have a flutter app that uses hiveDB, its working perfectly on iOS device and simulator, but when building it on macOS, the following error pops.

Unhandled Exception: HiveError: Cannot read, unknown typeId: 32. Did you forget to register an adapter?

This is my main method:

main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Hive.initFlutter();
  Hive.registerAdapter(PriceAdapter());
  Hive.registerAdapter(AmountAdapter());
  Hive.registerAdapter(CustomerAdapter());
  Hive.registerAdapter(ProductAdapter());
  Hive.registerAdapter(FactorAdapter());
  await Hive.openBox<Product>(TableName.PRODUCT);
  await Hive.openBox<Factor>(TableName.FACTOR);
  runApp(MyApp());
}
mck
  • 40,932
  • 13
  • 35
  • 50
SinaMN75
  • 6,742
  • 5
  • 28
  • 56

0 Answers0