rebuild the app after do something like change the theme or change the current language , iam using the ( easy_localization: ^3.0.0 ) package to change the lang EasyLocalization( child: MyApp(currentMode: currentMode), supportedLocales: const [ Locale('ar'), Locale('en'), ], path: 'assets/translations', startLocale: const Locale('ar'), assetLoader: const CodegenLoader(), ),
CodePudding user response:
If you're looking for the solution to this problem, this one works perfectly(tested) !
- Add the package phoenix from here
- Wrap your main widget with Phoenix
void main() {
runApp(
Phoenix(
child: App(),
),
);
}
- Call rebirth method anywhere in your app like so
Phoenix.rebirth(context);
CodePudding user response:
Or make use of state management solutions like riverpod.
You place your settings in a provider and watch it on the pages that should change when the state updates.
