close method

Future<void> close()

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

Implementation

Future<void> close() async {
  await _displayDevice._close();
  for (var device in devices) {
    await device._close();
  }
  if (_propertiesChangedSubscription != null) {
    await _propertiesChangedSubscription!.cancel();
    _propertiesChangedSubscription = null;
  }
  if (_deviceAddedSubscription != null) {
    await _deviceAddedSubscription!.cancel();
    _deviceAddedSubscription = null;
  }
  if (_deviceRemovedSubscription != null) {
    await _deviceRemovedSubscription!.cancel();
    _deviceRemovedSubscription = null;
  }
  if (_closeBus) {
    await _bus.close();
  }
}