I am actually aware of this implementation: Flutter programmatically closing the app, but when the app closes is still in background. How can I absolutely kill the app and not let it be in background?
Thank you!
If you don't want to use invokeMethod, you can directly close the app using
SystemNavigator.pop(); // Only works on Android.
While exit(0) works on both iOS and Android, it shouldn't be used on either. Read this answer for more information.
You can use exit(0). But app exits abruptly. You can use the below code which is much smoother.
SystemChannels.platform.invokeMethod<void>('SystemNavigator.pop')
Documentation is available here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With