unregister method

Future<void> unregister(
  1. HotKey hotKey
)

Implementation

Future<void> unregister(HotKey hotKey) async {
  if (!_inited) _init();

  if (hotKey.scope == HotKeyScope.system) {
    await _channel.invokeMethod('unregister', hotKey.toJson());
  }
  if (_keyDownHandlerMap.containsKey(hotKey.identifier)) {
    _keyDownHandlerMap.remove(hotKey.identifier);
  }
  if (_keyUpHandlerMap.containsKey(hotKey.identifier)) {
    _keyUpHandlerMap.remove(hotKey.identifier);
  }

  _hotKeyList.removeWhere((e) => e.identifier == hotKey.identifier);
}