On flutter how to send keys on the seperated text box

    if (otpInputElements.size() == 4) {
        boolean continueButtonEnabled = false;
        WebElement continueButton = testDriver.findElement(new AppiumBy.ByAndroidUIAutomator("")); // Adjust locator as needed

        while (!continueButtonEnabled) {
            for (int i = 0; i < 4; i++) {
                boolean success = false;
                attempts = 0;
                maxAttempts = 3;

                while (!success && attempts < maxAttempts) {
                    try {
                        // Tap on the text box before entering text
                        otpInputElements.get(i).click();
                        // Enter OTP digit
                        otpInputElements.get(i).sendKeys(Character.toString(otp.charAt(i)));

                        // Wait for a short time to ensure text is properly entered
                        Thread.sleep(1000); // Adjust sleep duration if necessary

                        // Validate that the text was entered correctly
                        String enteredValue = otpInputElements.get(i).getText();
                        if (enteredValue.equals(Character.toString(otp.charAt(i)))) {
                            System.out.println("OTP digit " + (i + 1) + " verified successfully.");
                            success = true; // Exit retry loop
                        } else {
                            System.out.println("Verification failed for OTP digit " + (i + 1) + ": Expected " + otp.charAt(i) + " but found " + enteredValue);
                            attempts++;
                            Thread.sleep(1000); // Retry delay
                        }
                    } catch (Exception e) {
                        System.out.println("Exception while processing OTP digit " + (i + 1) + ": " + e.getMessage());
                        attempts++;
                        Thread.sleep(1000); // Retry delay
                    }
                }

                if (!success) {
                    System.out.println("Failed to enter OTP digit " + (i + 1) + " after " + maxAttempts + " attempts.");
                    testDriver.quit();
                    return; // Exit if any OTP digit fails to enter
                }
            }

            // Check if the continue button is enabled
            try {
                continueButtonEnabled = wait.until(ExpectedConditions.elementToBeClickable(continueButton)).isEnabled();
                if (continueButtonEnabled) {
                    System.out.println("Continue button is enabled. Proceeding...");
                } else {
                    System.out.println("Continue button is not enabled yet. Retrying OTP entry...");
                    Thread.sleep(2000); // Wait before retrying OTP entry
                }
            } catch (Exception e) {
                System.out.println("Exception while checking continue button status: " + e.getMessage());
                Thread.sleep(2000); // Wait before retrying
            }
        }
    } else {
        System.out.println("Could not locate all OTP input elements.");
    }

this is my code i tried to put every valiation but the test case pass with actioning the UI how do you solver that problem