complete method

Future<void> complete()

Implementation

Future<void> complete() async {
  __.in_('complete');
  try {
    // Before completing the flow, we need to make sure it's clean
    // and all tasks are finished

    await performCleanup();

    // Call the end handler
    onEnd();

    // Clear flow state
    // flowState.clear();
    flowState.removeWhere((key, value) => key != 'appUser');

    __.info('Flow completed: $flowType');
  } catch (e, stackTrace) {
    __.severe('Error completing flow', e, stackTrace);
    throw hujFlowException(
      message: 'Failed to complete flow',
      hujType: hujErrorType.flow,
      originalError: e,
    );
  } finally {
    __.out_('complete');
  }
}