using the system back button from flutter driver using the system back button from flutter driver flutter flutter

using the system back button from flutter driver


If you have adb installed on your machine, you can run a command to perform the backpress using a keyevent:

import 'dart:io';
await Process.run(  'adb',   <String>['shell', 'input', 'keyevent', 'KEYCODE_BACK'],   runInShell: true,);


Maybe this can help you

 await device.shellExec('input', <String>['keyevent', 'KEYCODE_BACK']);

Found in one of the official flutter driver tests link


Check out this link. In short, you'll need to use WillPopScope class that handles device back button with callbacks.