pageBack method
Makes an effort to dismiss the current page with a Material Scaffold or a CupertinoPageScaffold.
Will throw an error if there is no back button in the page.
Implementation
Future<void> pageBack() async {
return TestAsyncUtils.guard<void>(() async {
Finder backButton = find.byTooltip('Back');
if (backButton.evaluate().isEmpty) {
backButton = find.byType(CupertinoNavigationBarBackButton);
}
expectSync(backButton, findsOneWidget, reason: 'One back button expected on screen');
await tap(backButton);
});
}