'How to bring app to foreground in flutter integration test
I have an integration test which taps a text of phone number, then it opens the phone dial app which makes my app put to background.
final firstNumber = find.byWidgetPredicate(
(widget) => widget is RichText && tapTextSpan(widget, '09123456789'));
await tester.tap(firstNumber);
After tester.tap() it successfully open the built in dial app in phone.
How can I bring my app to foreground?
Package used: integration_test, flutter_test
Solution 1:[1]
You can use flutter_foreground_task package
use FlutterForegroundTask.minimizeApp() for app to background
and FlutterForegroundTask.launchApp() for app to foreground
that's all. I hope it helps.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | JCode |
