isCalculationRunning static method
Checks if a route calculation is still in progress.
Queries whether the calculation identified by the given TaskHandler is currently running. Returns false if the calculation has completed (either successfully or with an error), was cancelled, or if the handler is invalid.
Useful for UI state management (e.g., showing/hiding progress indicators) or deciding whether cancellation is necessary. Check this before calling cancelRoute to avoid unnecessary operations.
Parameters
taskHandler: The TaskHandler returned by calculateRoute to check.
Returns
trueif the calculation is currently in progress.falseif the calculation has finished, was cancelled, or handler is invalid.
See also:
- getRouteStatus - Retrieves detailed calculation status.
- cancelRoute - Cancels the calculation if still running.
Implementation
static bool isCalculationRunning(final TaskHandler taskHandler) {
taskHandler as TaskHandlerImpl;
final OperationResult result = staticMethod(
'RoutingService',
'isCalculationRunning',
args: taskHandler.id,
);
return result['result'];
}