I am developing a bluetooth application and i want to save paired devices in device's local. I am using "flutter blue" package for bluetooth connection and i want to use "hive" for storing process. If i want to connect bluetooth device i have to use "flutter blue"s class.For example :
late BluetoothDevice device; // device is an object of BluetoothDevice class
await device.connect();
This BluetoothDevice class has different arguments like id,name etc.
if i want to save the device and connect later, as you can see i have to store device as BluetoothDevice type.
I am trying to save the device with this extended hive class
part 'savedDevice.g.dart';
@HiveType(typeId: 0)
class SavedDevice extends HiveObject {
@HiveField(0)
late BluetoothCharacteristic btcharacter; //BluetoothCharacteristic is a flutter blue's class
@HiveField(1)
late BluetoothService btService; //BluetoothService is a flutter blue's class
@HiveField(2)
late BluetoothDevice btdevice; //BluetoothDevice is a flutter blue's class
@HiveField(3)
late String btid;
}
When i run it throws this error " Cannot write, unknown type: BluetoothCharacteristic. Did you forget to register an adapter? "
I think i have to register adapter for every classes that i use from "flutter blue"s classess.But i dont know how to do it. Could you help me with this ?
Btw i am facing only this problem at storing data. Other things works fine.
i generated above adapter class but it still shows the error