dispose method

void dispose()

Closes the native device and the event stream.

Always call this when you're done using the controller (e.g. in a widget's dispose() or when the app closes) to release the HIDAPI handle.

Implementation

void dispose() {
  if (_device != ffi.nullptr) {
    _bindings.hidClose(_device);
    _device = ffi.nullptr;
  }
  _stateStreamController.close();
}