run method
Executes the effect immediately with the supplied handler. Each effect
implementation defines how it schedules work, emits values, and registers
disposables.
Implementation
@override
Future<void> run(
EffectHandler<Value> handler,
) async {
if (!handler.guard()) return;
late Value result;
try {
result = runner();
} catch (e, stackTrace) {
assert(
onError != null,
"When error can happens, onError should not be null",
);
result = onError!(e, stackTrace);
}
handler.emit(result);
}