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

_AssertionError ('dart:ui/window.dart': Failed assertion: line 281: '<optimized out>': is not true.) #31

Closed
AkshayPathak-RhythmSoft opened this issue Nov 7, 2019 · 12 comments · Fixed by #41

Comments

@AkshayPathak-RhythmSoft
Copy link

ELError

Getting this error when phone language is something else except the one defined by us in app.
steps to recreate error :
change phone language to something else than what is defined
Example : defined languages en-US,ar-DZ then set language to French in particular
install app

@pulstar
Copy link

pulstar commented Nov 14, 2019

I am experiencing the same problem, but my device language is correct.

E/flutter ( 5394): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: 'dart:ui/window.dart': Failed assertion: line 281: '': is not true.
E/flutter ( 5394): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:40:39)
E/flutter ( 5394): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter ( 5394): #2 new Locale (dart:ui/window.dart:281:15)
E/flutter ( 5394): #3 _EasyLocalizationState.saveLocale. (package:easy_localization/easy_localization_provider.dart:58:24)
E/flutter ( 5394): #4 State.setState (package:flutter/src/widgets/framework.dart:1141:30)
E/flutter ( 5394): #5 _EasyLocalizationState.saveLocale (package:easy_localization/easy_localization_provider.dart:57:7)
E/flutter ( 5394):
E/flutter ( 5394): #6 _EasyLocalizationState.initState (package:easy_localization/easy_localization_provider.dart:36:5)
E/flutter ( 5394): #7 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4068:58)
E/flutter ( 5394): #8 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5)
E/flutter ( 5394): #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter ( 5394): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter ( 5394): #11 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:998:16)
E/flutter ( 5394): #12 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:969:5)
E/flutter ( 5394): #13 RenderObjectToWidgetAdapter.attachToRenderTree. (package:flutter/src/widgets/binding.dart:915:17)
E/flutter ( 5394): #14 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2328:19)
E/flutter ( 5394): #15 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:914:13)
E/flutter ( 5394): #16 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:795:7)
E/flutter ( 5394): #17 runApp (package:flutter/src/widgets/binding.dart:845:7)
E/flutter ( 5394): #18 main (package:bargainer_pro/main.dart:29:3)
E/flutter ( 5394): #19 _runMainZoned.. (dart:ui/hooks.dart:229:25)
E/flutter ( 5394): #20 _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 5394): #21 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 5394): #22 _runZoned (dart:async/zone.dart:1516:10)
E/flutter ( 5394): #23 runZoned (dart:async/zone.dart:1500:12)
E/flutter ( 5394): #24 _runMainZoned. (dart:ui/hooks.dart:221:5)
E/flutter ( 5394): #25 _startIsolate. (dart:isolate-patch/isolate_patch.dart:305:19)
E/flutter ( 5394): #26 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

@pulstar
Copy link

pulstar commented Nov 14, 2019

This problem have something to do with SharedPreferences plug-in. I updated it to the version ^0.5.4+5 and removed the line below from my main.dart file. This solved the problem above.

SharedPreferences.setMockInitialValues({});

@Eugnis
Copy link

Eugnis commented Dec 1, 2019

Same error with Flutter 1.9.1+hotfix.6. Updating SharedPreferences not fixed this.

@alectogeek
Copy link

Same error on Flutter Channel master, v1.12.3-pre.10

@alectogeek
Copy link

Looks like smth happens during creation of new Locale

image
image

@alectogeek
Copy link

Any updates here? Guys, who faced same problem, can I send my app to prod with this error?

@damfrg
Copy link

damfrg commented Jan 9, 2020

Error is in saveLocale() function... in if statemente :/
Here is fix
image

@damfrg
Copy link

damfrg commented Jan 9, 2020

|| allowed _codeLang to be null and _codeCoun was set to some value.. Replace || with && and i added extra measure _codeLang != '' to fullfill assert in Locale constructor...

@dominwong4
Copy link

image
I Fix it like this. but it is not a best solution if you don't have default lang

@jalalonagh
Copy link

damfrg solution worked for me , but I don't know Why ?

@aissat aissat closed this as completed in #41 Feb 5, 2020
@pulstar
Copy link

pulstar commented Feb 5, 2020

Glad to hear about that! Hope the package at pub.dev be updated soon.

@aissat
Copy link
Owner

aissat commented Feb 6, 2020

@pulstar it's ready
enjoying

@pulstar
Copy link

pulstar commented Feb 7, 2020

I updated here, but it could not find the EasylocaLizationDelegate... I figured out the problem and is the class name, that changed from "EasylocaLizationDelegate" to "EasyLocalizationDelegate"... (notice the uppercase L position). Everything is fine now.

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

Successfully merging a pull request may close this issue.

8 participants