I/flutter ( 3071): 'dart:ui/painting.dart': Failed assertion: line 187: '<optimized out>': is not true.
Such errors are popping up recently in Flutter issues
I assume the failing expression should still be shown.
@zanderso @aam I think we had an existing bug about the assert snippets lacking source?
Duplicate of #34586
I had the same problem.
Unhandled exception:
'dart:async/future_impl.dart': Failed assertion: line 146: '<optimized out>': is not true.
#0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
#1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
#2 _FutureListener.handleError (dart:async/future_impl.dart:146:14)
#3 Future._propagateToListeners.handleError (dart:async/future_impl.dart:654:47)
#4 Future._propagateToListeners (dart:async/future_impl.dart:675:24)
#5 Future._completeError (dart:async/future_impl.dart:494:5)
#6 _SyncCompleter._completeError (dart:async/future_impl.dart:55:12)
#7 _Completer.completeError (dart:async/future_impl.dart:27:5)
#8 _AsyncAwaitCompleter.completeError (dart:async/runtime/libasync_patch.dart:40:18)
#9 Dio.get (package:dio/src/dio.dart)
<asynchronous suspension>
#10 main (file:///Users/duwen/Documents/code/dio/example/cancelRequest.dart:34:7)
<asynchronous suspension>
#11 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:289:19)
#12 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
If you use .then() clauses don't use await.
.then() and await are two different ways to handle Future's but shouldn't be used for the same Future instance. you can split them and link them with a variable if you wish
E/flutter ( 5337): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: 'dart:ui/window.dart': Failed assertion: line 284: '
E/flutter ( 5337): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
E/flutter ( 5337): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
E/flutter ( 5337): #2 new Locale (dart:ui/window.dart:284:15)
E/flutter ( 5337): #3 _EasyLocalizationState.saveLocale.
E/flutter ( 5337): #4 State.setState (package:flutter/src/widgets/framework.dart:1148:30)
E/flutter ( 5337): #5 _EasyLocalizationState.saveLocale (package:easy_localization/easy_localization_provider.dart:57:7)
E/flutter ( 5337):
E/flutter ( 5337): #6 _EasyLocalizationState.initState (package:easy_localization/easy_localization_provider.dart:36:5)
E/flutter ( 5337): #7 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)
E/flutter ( 5337): #8 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
E/flutter ( 5337): #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
E/flutter ( 5337): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
E/flutter ( 5337): #11 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1028:16)
E/flutter ( 5337): #12 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:999:5)
E/flutter ( 5337): #13 RenderObjectToWidgetAdapter.attachToRenderTree.
E/flutter ( 5337): #14 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2412:19)
E/flutter ( 5337): #15 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:941:13)
E/flutter ( 5337): #16 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:819:7)
E/flutter ( 5337): #17 WidgetsBinding.scheduleAttachRootWidget.
E/flutter ( 5337): #18 _rootRun (dart:async/zone.dart:1122:38)
E/flutter ( 5337): #19 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter ( 5337): #20 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
E/flutter ( 5337): #21 _CustomZone.bindCallbackGuarded.
E/flutter ( 5337): #22 _rootRun (dart:async/zone.dart:1126:13)
E/flutter ( 5337): #23 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter ( 5337): #24 _CustomZone.bindCallback.
E/flutter ( 5337): #25 Timer._createTimer.
E/flutter ( 5337): #26 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)
E/flutter ( 5337): #27 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
E/flutter ( 5337): #28 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
E/flutter ( 5337):
Most helpful comment
If you use .then() clauses don't use await.
.then() and await are two different ways to handle Future's but shouldn't be used for the same Future instance. you can split them and link them with a variable if you wish