close method

Future<void> close()

Terminates the connection to the fwupd daemon. If a client remains unclosed, the Dart process may not terminate.

Implementation

Future<void> close() async {
  if (_propertiesChangedSubscription != null) {
    await _propertiesChangedSubscription!.cancel();
    _propertiesChangedSubscription = null;
  }
  if (_deviceAddedSubscription != null) {
    await _deviceAddedSubscription!.cancel();
    _deviceAddedSubscription = null;
  }
  if (_deviceChangedSubscription != null) {
    await _deviceChangedSubscription!.cancel();
    _deviceChangedSubscription = null;
  }
  if (_deviceRemovedSubscription != null) {
    await _deviceRemovedSubscription!.cancel();
    _deviceRemovedSubscription = null;
  }
  _devices.clear();
  if (_closeBus) {
    await _bus.close();
  }
}