addCleanup method

void addCleanup(
  1. Future<void> callback()
)

Register resources owned by this attempt.

These callbacks run after adapter-specific close work and before the attempt runtime scope is restored. Both execution paths use this same owner so setup failures and normal completion drain resources uniformly.

Implementation

void addCleanup(Future<void> Function() callback) => _cleanup.add(callback);