perform method
perform an async operation
Implementation
@protected
Future perform(Future<E> future, [Object? key]) async {
final Object asyncKey = key ?? _defaultKey;
final int gen = _createGen(asyncKey);
onAsyncStateChanged(FormeAsyncOperationState.processing, key);
E result;
try {
result = await future;
} catch (e, stackTrace) {
if (_compareGen(gen, asyncKey)) {
onError(e, stackTrace);
}
return;
}
if (_compareGen(gen, asyncKey)) {
onAsyncStateChanged(FormeAsyncOperationState.success, key);
onSuccess(result, key);
}
}