flutter_foreground_task icon indicating copy to clipboard operation
flutter_foreground_task copied to clipboard

Question WithForegroundTask

Open jalys opened this issue 1 year ago • 1 comments

Hello ,

i need help using the Widget WithForegroundTask. I followed the tutorial , adding the widget just before the scaffold. The apps starts fine the foregrounbd task too, but if i close app , the task shutdown too. How can i debug my app ?

For now i just added the code from the example in my app. I use riverpod , so my app do not depends on <State> but <ConsumerState> could it be the issue ?

jalys avatar Apr 09 '23 20:04 jalys

by the way if i remove the WithForegroundTask

from the example

@override Widget build(BuildContext context) { // A widget that prevents the app from closing when the foreground service is running. // This widget must be declared above the [Scaffold] widget. return WithForegroundTask( child: Scaffold( appBar: AppBar( title: const Text('Flutter Foreground Task'), centerTitle: true, ), body: _buildContentView(), ), ); }

i got no change, will closing app , it do not close , i still get notification running in top bar. On other side in my app if i add the WithForegroundTask widget , the app closes as it should prevent it to happen.

jalys avatar Apr 11 '23 11:04 jalys