subscribe method
Implementation
Function subscribe(String key, Function callback) {
String privateKey = randomString(10);
if (_listeners.containsKey(key)) {
_listeners[key] = {..._listeners[key]!, privateKey: callback};
} else {
_listeners[key] = {privateKey: callback};
}
return () {
_listeners[key]?.remove(privateKey);
};
}