unregister method
Unregisters a callback.
Implementation
bool unregister(int id, CallbackNode? node) {
assert(node != null, 'Expected non-null node');
assert(
node!.registrations == this,
'Expected node to come from this registrations instance',
);
if (id == 0) {
return false;
}
if (node!.id != id) {
return false;
}
if (callbacks == node) {
assert(node.prev == null);
callbacks = node.next;
} else {
assert(node.prev != null);
node.prev!.next = node.next;
}
if (node.next != null) {
node.next!.prev = node.prev;
}
_recycle(node);
return true;
}