Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please wrap your app with TranslationProvider - but it's aready wrapped #262

Open
FluffyDiscord opened this issue Nov 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@FluffyDiscord
Copy link

Hi, I have wrapped my app with TranslationProvider as mentioned in docs, but I still get the following error:
Please wrap your app with "TranslationProvider"

I am trying to access translation on a context (context.t.action.loginToApp) so it auto re-renders when I change locale.

I am confused, what am I doing wrong?

runApp(TranslationProvider(
  child: SentryScreenshotWidget(
    child: MyApp(
      initialRoute: await getInitialRoute(),
    ),
  ),
));


class MyApp extends GetView<SideDrawerController> {
  const MyApp({
    super.key,
    required this.initialRoute,
  });

  final String initialRoute;

  @override
  Widget build(BuildContext context) {
    return  GetMaterialApp(
      locale: TranslationProvider.of(context).flutterLocale,
...
@FluffyDiscord FluffyDiscord changed the title Please wrap your app with TranslationProvider, but it's aready wrapped Please wrap your app with TranslationProvider - but it's aready wrapped Nov 10, 2024
@Tienisto
Copy link
Member

It should work, I don't understand this either. Maybe a widget in between somehow destroys the TranslationProvider.
Just to make sure, you have only a single TranslationProvider right?

@FluffyDiscord
Copy link
Author

Yes, only one, at the runApp()

@Tienisto Tienisto added the bug Something isn't working label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants