extendTimeout method
Extends the timeout for the current conversation.
This adds additional time to the conversation's expiry time.
Example:
await conversation.extendTimeout(Duration(minutes: 10));
Implementation
Future<void> extendTimeout(Duration additionalTime) async {
final state = await _storage.get(_storageKey);
if (state != null) {
final currentExpiry =
state.expiresAt ?? state.lastUpdated.add(_defaultTimeout);
final newExpiry = currentExpiry.add(additionalTime);
final updatedState = state.copyWith(expiresAt: newExpiry);
await _storage.set(_storageKey, updatedState);
}
}