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

_systemLocale null #3

Closed
JCKodel opened this issue Nov 23, 2019 · 4 comments
Closed

_systemLocale null #3

JCKodel opened this issue Nov 23, 2019 · 4 comments

Comments

@JCKodel
Copy link

JCKodel commented Nov 23, 2019

image

I/flutter (14367): [2019-11-23 04:10:51.568618 | ConsoleHandler | INFO] NoSuchMethodError: The method 'replaceAll' was called on null.
I/flutter (14367): Receiver: null
I/flutter (14367): Tried calling: replaceAll(RegExp: pattern=^[_ ]+|[_ ]+$ flags=, "")
I/flutter (14367): [2019-11-23 04:10:51.574261 | ConsoleHandler | INFO]
I/flutter (14367): [2019-11-23 04:10:51.576518 | ConsoleHandler | INFO] ------- STACK TRACE -------
I/flutter (14367): [2019-11-23 04:10:51.598902 | ConsoleHandler | INFO] #0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:51:5)
I/flutter (14367): [2019-11-23 04:10:51.602977 | ConsoleHandler | INFO] #1      I18n._trimLocale 
package:i18n_extension/i18n_widget.dart:53
I/flutter (14367): [2019-11-23 04:10:51.603718 | ConsoleHandler | INFO] #2      I18n.localeStr 
package:i18n_extension/i18n_widget.dart:48
I/flutter (14367): [2019-11-23 04:10:51.604203 | ConsoleHandler | INFO] #3      _effectiveLocale 
package:i18n_extension/i18n_extension.dart:213
I/flutter (14367): [2019-11-23 04:10:51.604531 | ConsoleHandler | INFO] #4      localize 
package:i18n_extension/i18n_extension.dart:48
I/flutter (14367): [2019-11-23 04:10:51.604829 | ConsoleHandler | INFO] #5      Localization.i18n 
@marcglasberg
Copy link
Owner

The above info is not enough info for me to see what's going on. It just tells me the locale is null. Please, provide me with a single file with a minimum runnable example, including the main method.

However, I would guess, since the locale is unknown, that you forgot to wrap your widgets with I18n(child: ...). Please make sure you are doing this:

@override
Widget build(BuildContext context) {
 return MaterialApp(
   home: I18n(child: ...)
 );
}

@weraaaaz
Copy link

weraaaaz commented Dec 4, 2019

I have the same error. UsingText("Hello there".i18n) and my_widget.i18n.dart file

@weraaaaz
Copy link

weraaaaz commented Dec 4, 2019

Ok, fixed by adding @override Widget build(BuildContext context) { return MaterialApp( home: I18n(child: ...) ); } . It wasn't very clear in docs that you need this if you use translatable strings

@marcglasberg
Copy link
Owner

@weraaaaz I'll make it clearer in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants