resetCamera method

Future<void> resetCamera(
  1. BuildContext context
)

Implementation

Future<void> resetCamera(BuildContext context) async {
  // Extract context-dependent values before async operations
  final setupFailedError = CameraErrorStrings(context).setupFailed;

  await stopSession();

  _safeSetState(DocumentScanState(
    screen: side == DocumentSide.front
        ? AppScreen.scanIdDocumentFrontScreen
        : AppScreen.scanIdDocumentBackScreen,
    currentSide: side,
  ));

  _setupAttempted = false;
  await _initializeCamera(setupFailedError);
  await startSession(setupFailedError);
}