runOperation method

void runOperation(
  1. Future operation
)

Executes the given operation, which is a Future representing an asynchronous task.

If the operation succeeds, onSuccess is called; otherwise, onFailed is triggered.

Implementation

void runOperation(Future<dynamic> operation) {
  _operationCheckerService.inProgress();
  operation.then((result) {
    _operationCheckerService
        .onSuccess(result ?? "Operation completed successfully");
  }).catchError((error) {
    _operationCheckerService
        .onFailed("Operation failed with error: ${error.toString()}");
  });
}