flow function

dynamic flow(
  1. BuildContext context
)

Implementation

flow(BuildContext context) {
  if (steps.isEmpty) {
    return;
  }
  if (current == null) {
    current = steps.first;
    navigate(context, current!.scanItem!, current!.documentType);
  } else {
    int nextIndex = steps.indexOf(current!) + 1;
    if (nextIndex < steps.length) {
      if (steps[nextIndex].scanItem == 2) {
        faceMatch = true;
        current = steps[nextIndex];
        flow(context);
      } else {
        current = steps[nextIndex];
        navigate(context, current!.scanItem!, current!.documentType);
      }
    } else {
      if (faceMatch) {
        goTo(context, const FaceVerifyLoading());
      } else {
        goTo(context, const SubmitScanLoading());
      }
    }
  }
}