onResult method
Registers a listener (addListener) that will be invoked with the key and result of the last modified ResultNotifier, whenever one is modified.
Use the returned VoidCallback function to unsubscribe the callback.
Implementation
@useResult
VoidCallback onResult(void Function(K key, Result<T> result) callback) {
void listener() {
final modification = _currentModification;
if (modification != null) {
callback(modification.key, modification.result);
}
}
addListener(listener);
return () => removeListener(listener);
}