Skip to content

Commit

Permalink
fix(main): Use the same ProviderContainer reading locales in main
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Dec 6, 2023
1 parent e9afc21 commit 628f136
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await initStorage();
await initCache();
// FIXME: Do not use ProviderContainer.
final settingsLocale = ProviderContainer().read(appSettingsProvider).locale;
final container = ProviderContainer();
final settingsLocale = container.read(appSettingsProvider).locale;
final locale =
AppLocale.values.firstWhereOrNull((v) => v.languageTag == settingsLocale);
if (locale == null) {
Expand All @@ -37,7 +37,8 @@ Future<void> main() async {
Breakpoint(start: 650, end: 650, name: 'homepage_welcome_expand'),
Breakpoint(start: 900, end: 900, name: 'app_expand_side_panel'),
],
child: const ProviderScope(child: TClientApp()),
child: UncontrolledProviderScope(
container: container, child: const TClientApp()),
),
),
);
Expand Down

0 comments on commit 628f136

Please sign in to comment.