Flutter how to programmatically exit the app

 void _getOutOfApp {


      if (Platform.isIOS) {

        try {
          exit(0); 
        } catch (e) {
          SystemNavigator.pop(); // for IOS, not true this, you can make comment this :)
        }

      } else {

        try {
          SystemNavigator.pop(); // sometimes it cant exit app  
        } catch (e) {
          exit(0); // so i am giving crash to app ... sad :(
        }

      }
    }

Post a Comment

Previous Post Next Post

Subscribe Us


Get tutorials, Flutter news and other exclusive content delivered to your inbox. Join 1000+ growth-oriented Flutter developers subscribed to the newsletter

100% value, 0% spam. Unsubscribe anytime