I have the same error calling driver.takeScreenshot()
or driver.saveScreenshot(...)
with WebDriverIO + Appium.
The solution was to switch context to NATIVE_APP then takeScreenshot and finally switch context back to FLUTTER.
await driver.switchContext("NATIVE_APP");
await driver.takeScreenshot();//or saveScreenshot(screenshotPath)
await driver.switchContext("FLUTTER");
I know that is not directly answering your question but I hope it might help you in some way!