Can not scroll to element on iOs flutter app

Hi guys, I try to scroll to element from flutter app using Appium. I want to access element via xpath. For this purpose use this script:

JavascriptExecutor js = (JavascriptExecutor) driver;
WebElement element = webDriver.findElement(By.xpath("//div[@class=‘et_pb_text_inner’]/p[2]"));
Map<String, Object> params = new HashMap<>();
params.put(“direction”, “down”);
params.put(“element”, ((RemoteWebElement) element).getId());
js.executeScript(“mobile: swipe”, params);

As a result the appium does not find the element and scrolls down the page below it. Can you please help what could be the problem?

You can’t use xpath for flutter app. you have to use different types of identifier like valuekey, tooltip etc. to locate the element first. then, you have to execute scrolling operation. following code worked for me.

WebElement scrollableElement = find.byValueKey(“Scroll”);

    WebElement listViewElement = find.byValueKey("Scroll");
    driver.executeScript("flutter: scroll", listViewElement, new HashMap<String, Object>() {{
        put("dx", 90);
        put("dy", -400);
        put("durationMilliseconds", 200);
        put("frequency", 30);

make sure u have add the valuekey in your project repo’s respective screen.