TaskHooks class abstract

Global lifecycle hooks for task execution.

Register callbacks to track all task events:

  • When a task starts
  • When a task completes successfully
  • When a task fails
  • When a chain completes

Perfect for:

  • Sentry/Crashlytics error reporting
  • Analytics and metrics
  • Logging and debugging
  • Custom notifications

Example:

TaskFlow.onTaskFailed((entry) {
  Sentry.captureException(
    Exception(entry.error),
    stackTrace: entry.stackTrace,
  );
});

TaskFlow.onTaskComplete((entry) {
  print('Task ${entry.taskName} took ${entry.durationMs}ms');
});

Constructors

TaskHooks()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

clear() → void
Clear all hooks
onChainComplete(void callback(String chainId, String status)) → void
Register callback for chain completion
onTaskComplete(void callback(TaskHistoryEntry)) → void
Register callback for task completion
onTaskFailed(void callback(TaskHistoryEntry)) → void
Register callback for task failure
onTaskStart(void callback(TaskHistoryEntry)) → void
Register callback for task start