tryGetData method
Get data with error handling
Implementation
RxResult<T> tryGetData() {
RxTracking.track(this);
if (hasError) {
final err = error;
final rxError = err is RxException
? err
: RxException.withTimestamp(
'Future has error state',
originalError: err,
);
return RxResult.failure(rxError);
}
if (!hasData) {
return RxResult.failure(
RxException.withTimestamp('Future has no data available'),
);
}
return RxResult.success(data as T);
}