removeListener method

  1. @VoltronMethod(kModuleRemoveListener)
void removeListener(
  1. String name,
  2. JSPromise promise
)

Implementation

@VoltronMethod(kModuleRemoveListener)
void removeListener(String name, JSPromise promise) {
  if (!_eventMap.containsKey(name)) {
    return;
  }
  var count = _eventMap[name]!;
  if (count == 1) {
    handleRemoveListener(name);
    _eventMap.remove(name);
  } else {
    count--;
    _eventMap.remove(name);
    _eventMap[name] = count;
  }
}