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
The getter '{string_key}' was called on null. #35
Comments
I need more info. |
@long1eu ,i created another issue in the flutter repo it contains more details i am using this SDK
|
You didn't setup the plugin. You don't have the proper LocalisationDelegate
into you app. Follow the instructions carefully.
În joi, 10 ian. 2019, 19:35 ammar-esrawi <notifications@github.com a scris:
… @long1eu <https://github.com/long1eu>
I think the problem comes from the flutter frame work it self
but in general the issue occur once you try to reach the
S.of(context).SOMETHING inside a StateFull widget this will make the call
return Localizations.of<S>(context, S); returns null instead of instance
from S class
,i created another issue in the flutter repo it contains more details
please follow this <flutter/flutter#26365>
i am using this SDK
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI2nVlDdfGBIWj3BLdbQds9c5ABH_nl4ks5vB3nhgaJpZM4Z4OhQ>
.
|
Feel free to reopen the issues if you have the same problem after following the instructions. |
i tested your sample app and it did not work for me
this generated the following log
note : Thank you for the very useful plugin |
Your you can't use S with that context. S.of(context) will always return null. |
try it like this
|
this worked fine thank you |
Do you understand why?
În mar., 15 ian. 2019, 00:04 ammar-esrawi <notifications@github.com a scris:
… try it like this
class MyApp extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
onGenerateTitle: (BuildContext context) => S.of(context).app_name,
localizationsDelegates: const <LocalizationsDelegate<WidgetsLocalizations>>[
S.delegate,
],
supportedLocales: S.delegate.supportedLocales,
localeResolutionCallback: S.delegate.resolution(fallback: const Locale('en', '')),
localeListResolutionCallback: S.delegate.listResolution(fallback: const Locale('en', '')),
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Builder(
builder: (BuildContext context) {
return MyHomePage(title: S.of(context).app_name);
},
),
);
}
}
this worked fine thank you
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI2nVvMCjhg3pQtuAu5ymZQsPvU6lkBnks5vDP7WgaJpZM4Z4OhQ>
.
|
Yep i have been using the widget context since your generated Class S deppend on Localizations which only work in Material context so it worked through the builder I think these information need to be documented in Flutter website cuz i read the documents but this important info were not presented I appreciate your efforts Also i wish if you can work on a plugin for the toJson ,fromJson also, they are annoying issue |
delete the 'generated' package, then it will recreate automatic ,solved my problem |
static S of(BuildContext context) => Localizations.of<S>(context, S); ,
this call returns null
so the usage like will produce the exception The getter '{string_key}' was called on null.
The text was updated successfully, but these errors were encountered: