Flutter: how to force an application restart (in production mode)?

后端 未结 4 1063
無奈伤痛
無奈伤痛 2020-11-28 03:33

In production mode, is there a way to force a full restart of the application (I am not talking about a hot reload at development time!).

P

4条回答
  •  清酒与你
    2020-11-28 04:20

    The flutter_phoenix package is based on Rémi Rousselet's answer, making it even simpler.

    void main() {
      runApp(
        Phoenix(
          child: App(),
        ),
      );
    }
    

    Then when you need to restart the app, just call:

    Phoenix.rebirth(context);
    

提交回复
热议问题