stopListening method
void
stopListening()
call when you no more need to listen and free up resource
Implementation
void stopListening() {
final objectId = id.split("-").first;
final myListeners = _allListeners[objectId];
final me = myListeners?.remove(this) ?? false;
if (me) {
final toAdd = myListeners ?? [];
if (toAdd.isNotEmpty) {
_allListeners.update(objectId, (value) => toAdd);
}
sPrint("Object listener removed");
} else {
throw StrapiException(
msg: "This should not be the case, no listner found, $me",
);
}
}