How to force Flutter to rebuild / redraw all widgets?

后端 未结 9 1558
攒了一身酷
攒了一身酷 2020-12-03 06:32

Is there a way to force Flutter to redraw all widgets (e.g. after locale change)?

9条回答
  •  情深已故
    2020-12-03 07:08

    If you are creating a multi lang app I'd suggest you be using Localization Library to handle that. Even using conventions used by other applications.

    flutter_i18n - It also has a method to regenerate over runtime - documented at the bottom

    await FlutterI18n.refresh(buildContext, languageCode, {countryCode});
    

    What it does is generating widgets with state that is managed by a combined singelton resource that handles both dynamic data and visibility.

提交回复
热议问题