setLocale method

void setLocale(
  1. Locale newLocale
)

Updates the current locale of your app, then re-builds your app, so that your changes will be seen in the screen. If you don't want a re-build, you can directly set locale.

Implementation

void setLocale(Locale newLocale) {
  locale = newLocale;

  /// Reason of using this is updating the material/cupertino app is not
  /// enough to update all the strings, we do this and update everything.
  _widgetsBindingInstance.reassembleApplication();
}