cancelableFuture method

  1. @protected
Future? cancelableFuture(
  1. Future inner, {
  2. String? tag,
  3. bool needCheckConnection = true,
  4. bool needHandleError = true,
})
inherited

Wrap cancelable async process with connection status - needCheckConnection and error process if need - needHandleError

Implementation

@protected
Future? cancelableFuture(
  Future inner, {
  String? tag,
  bool needCheckConnection = true,
  bool needHandleError = true,
}) async {
  final preProcess =
      needCheckConnection ? () async => await checkConnection() : null;
  final process = _processCancelableFuture(inner, preProcess: preProcess);
  return needHandleError
      ? process?.onError((error, stackTrace) => handleError(error, tag: tag))
      : process;
}