setCurrentDeviceInfo method

Future<void> setCurrentDeviceInfo(
  1. Device currentDeviceInfo
)

set deviceInfo in currentDeviceNew NodeValue in :Local

@param user object @throws :Local not found on StorageException

Implementation

Future<void> setCurrentDeviceInfo(Device currentDeviceInfo) async {
  try {
    _node = await _storageController.get(":Local");

    currentDeviceInfo.deviceId = await _getCurrentDeviceId;
    localNodeValue = NodeValueImpl(
        "deviceDetails", Device.convertDeviceToJson(currentDeviceInfo));
    await _node!.addOrUpdateValue(localNodeValue!);
    await _storageController.update(_node!);
  } on StorageException {
    throw Exception(":Local not found");
  }
}