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

determine error incase of truth checking inside ternary operator #27123

Closed
jsuryahyd opened this issue Jan 26, 2019 · 2 comments
Closed

determine error incase of truth checking inside ternary operator #27123

jsuryahyd opened this issue Jan 26, 2019 · 2 comments

Comments

@jsuryahyd
Copy link

Erroneous Code :

isFavourite() {
    return wishListedUsers ? wishListedUsers.containsKey(id) : false;
}

So, the error was generated when I tried to check truthy of a Map (coming from javascript), inside a ternary operator.
Error says, that the it could not point out the exact stack and line of the error.(even though it does here.)
Ui breaks with red screen and overflowing.

I/flutter ( 6431): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 6431): The following assertion was thrown building ScopedModelDescendant<AppScopedModel>(dirty):
I/flutter ( 6431): type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'bool'
I/flutter ( 6431): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter ( 6431): more information in this error message to help you determine and fix the underlying cause.
I/flutter ( 6431): In either case, please report this assertion by filing a bug on GitHub:
I/flutter ( 6431):   https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter ( 6431): When the exception was thrown, this was the stack:
I/flutter ( 6431): #0      Product.isFavourite 
I/flutter ( 6431): #1      ProductsListItem._builderFunc.<anonymous closure> 
I/flutter ( 6431): #2      ScopedModelDescendant.build 
I/flutter ( 6431): #3      StatelessElement.build 
I/flutter ( 6431): #4      ComponentElement.performRebuild 
I/flutter ( 6431): #5      Element.rebuild 
I/flutter ( 6431): #6      ComponentElement._firstBuild 
I/flutter ( 6431): #7      ComponentElement.mount 
I/flutter ( 6431): #8      Element.inflateWidget 
I/flutter ( 6431): #9      Element.updateChild 
I/flutter ( 6431): #10     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #11     Element.inflateWidget 
I/flutter ( 6431): #12     MultiChildRenderObjectElement.mount 
I/flutter ( 6431): #13     Element.inflateWidget 
I/flutter ( 6431): #14     Element.updateChild 
I/flutter ( 6431): #15     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #16     Element.inflateWidget 
I/flutter ( 6431): #17     Element.updateChild 
I/flutter ( 6431): #18     ComponentElement.performRebuild 
I/flutter ( 6431): #19     Element.rebuild 
I/flutter ( 6431): #20     ComponentElement._firstBuild 
I/flutter ( 6431): #21     ComponentElement.mount 
I/flutter ( 6431): #22     Element.inflateWidget 
I/flutter ( 6431): #23     MultiChildRenderObjectElement.mount 
I/flutter ( 6431): #24     Element.inflateWidget 
I/flutter ( 6431): #25     Element.updateChild 
I/flutter ( 6431): #26     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #27     Element.inflateWidget 
I/flutter ( 6431): #28     Element.updateChild 
I/flutter ( 6431): #29     ComponentElement.performRebuild 
I/flutter ( 6431): #30     Element.rebuild 
I/flutter ( 6431): #31     ComponentElement._firstBuild 
I/flutter ( 6431): #32     ComponentElement.mount 
I/flutter ( 6431): #33     Element.inflateWidget 
I/flutter ( 6431): #34     Element.updateChild 
I/flutter ( 6431): #35     ComponentElement.performRebuild 
I/flutter ( 6431): #36     Element.rebuild 
I/flutter ( 6431): #37     ComponentElement._firstBuild 
I/flutter ( 6431): #38     StatefulElement._firstBuild 
I/flutter ( 6431): #39     ComponentElement.mount 
I/flutter ( 6431): #40     Element.inflateWidget 
I/flutter ( 6431): #41     Element.updateChild 
I/flutter ( 6431): #42     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #43     Element.inflateWidget 
I/flutter ( 6431): #44     Element.updateChild 
I/flutter ( 6431): #45     ComponentElement.performRebuild 
I/flutter ( 6431): #46     Element.rebuild 
I/flutter ( 6431): #47     ComponentElement._firstBuild 
I/flutter ( 6431): #48     ComponentElement.mount 
I/flutter ( 6431): #49     Element.inflateWidget 
I/flutter ( 6431): #50     Element.updateChild 
I/flutter ( 6431): #51     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #52     Element.inflateWidget 
I/flutter ( 6431): #53     Element.updateChild 
I/flutter ( 6431): #54     ComponentElement.performRebuild 
I/flutter ( 6431): #55     Element.rebuild 
I/flutter ( 6431): #56     ComponentElement._firstBuild 
I/flutter ( 6431): #57     ComponentElement.mount 
I/flutter ( 6431): #58     Element.inflateWidget 
I/flutter ( 6431): #59     Element.updateChild 
I/flutter ( 6431): #60     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #61     Element.inflateWidget 
I/flutter ( 6431): #62     Element.updateChild 
I/flutter ( 6431): #63     ComponentElement.performRebuild 
I/flutter ( 6431): #64     Element.rebuild 
I/flutter ( 6431): #65     ComponentElement._firstBuild 
I/flutter ( 6431): #66     StatefulElement._firstBuild 
I/flutter ( 6431): #67     ComponentElement.mount 
I/flutter ( 6431): #68     Element.inflateWidget 
I/flutter ( 6431): #69     Element.updateChild 
I/flutter ( 6431): #70     ComponentElement.performRebuild 
I/flutter ( 6431): #71     Element.rebuild 
I/flutter ( 6431): #72     ComponentElement._firstBuild 
I/flutter ( 6431): #73     StatefulElement._firstBuild 
I/flutter ( 6431): #74     ComponentElement.mount 
I/flutter ( 6431): #75     Element.inflateWidget 
I/flutter ( 6431): #76     Element.updateChild 
I/flutter ( 6431): #77     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #78     Element.inflateWidget 
I/flutter ( 6431): #79     Element.updateChild 
I/flutter ( 6431): #80     ComponentElement.performRebuild 
I/flutter ( 6431): #81     Element.rebuild 
I/flutter ( 6431): #82     ComponentElement._firstBuild 
I/flutter ( 6431): #83     ComponentElement.mount 
I/flutter ( 6431): #84     Element.inflateWidget 
I/flutter ( 6431): #85     Element.updateChild 
I/flutter ( 6431): #86     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #87     Element.inflateWidget 
I/flutter ( 6431): #88     Element.updateChild 
I/flutter ( 6431): #89     ComponentElement.performRebuild 
I/flutter ( 6431): #90     Element.rebuild 
I/flutter ( 6431): #91     ComponentElement._firstBuild 
I/flutter ( 6431): #92     ComponentElement.mount 
I/flutter ( 6431): #93     Element.inflateWidget 
I/flutter ( 6431): #94     Element.updateChild 
I/flutter ( 6431): #95     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #96     Element.inflateWidget 
I/flutter ( 6431): #97     Element.updateChild 
I/flutter ( 6431): #98     SingleChildRenderObjectElement.mount 
I/flutter ( 6431): #99     Element.inflateWidget 
I/flutter ( 6431): #100    Element.updateChild 
I/flutter ( 6431): #101    ComponentElement.performRebuild 
I/flutter ( 6431): #102    Element.rebuild 
I/flutter ( 6431): #103    ComponentElement._firstBuild 
I/flutter ( 6431): #104    ComponentElement.mount 
I/flutter ( 6431): #105    Element.inflateWidget 
I/flutter ( 6431): #106    Element.updateChild 
I/flutter ( 6431): #107    ComponentElement.performRebuild 
I/flutter ( 6431): #108    Element.rebuild 
I/flutter ( 6431): #109    ComponentElement._firstBuild 
I/flutter ( 6431): #110    ComponentElement.mount 
I/flutter ( 6431): #111    ParentDataElement.mount 
I/flutter ( 6431): #112    Element.inflateWidget 
I/flutter ( 6431): #113    Element.updateChild 
I/flutter ( 6431): #114    ComponentElement.performRebuild 
I/flutter ( 6431): #115    Element.rebuild 
I/flutter ( 6431): #116    ComponentElement._firstBuild 
I/flutter ( 6431): #117    StatefulElement._firstBuild 
I/flutter ( 6431): #118    ComponentElement.mount 
I/flutter ( 6431): #119    Element.inflateWidget 
I/flutter ( 6431): #120    Element.updateChild 
I/flutter ( 6431): #121    SliverMultiBoxAdaptorElement.updateChild 
I/flutter ( 6431): #122    SliverMultiBoxAdaptorElement.createChild.<anonymous closure> 
I/flutter ( 6431): #123    BuildOwner.buildScope 
I/flutter ( 6431): #124    SliverMultiBoxAdaptorElement.createChild 
I/flutter ( 6431): #125    RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> 
I/flutter ( 6431): #126    RenderObject.invokeLayoutCallback.<anonymous closure> 
I/flutter ( 6431): #127    PipelineOwner._enableMutationsToDirtySubtrees 
I/flutter ( 6431): #128    RenderObject.invokeLayoutCallback 
I/flutter ( 6431): #129    RenderSliverMultiBoxAdaptor._createOrObtainChild 
I/flutter ( 6431): #130    RenderSliverMultiBoxAdaptor.addInitialChild 
I/flutter ( 6431): #131    RenderSliverList.performLayout 
I/flutter ( 6431): #132    RenderObject.layout 
I/flutter ( 6431): #133    RenderSliverPadding.performLayout 
I/flutter ( 6431): #134    RenderObject.layout 
I/flutter ( 6431): #135    RenderViewportBase.layoutChildSequence 
I/flutter ( 6431): #136    RenderViewport._attemptLayout 
I/flutter ( 6431): #137    RenderViewport.performLayout 
I/flutter ( 6431): #138    RenderObject.layout 
I/flutter ( 6431): #139    _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter ( 6431): #140    RenderObject.layout 
I/flutter ( 6431): #141    _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter ( 6431): #142    RenderObject.layout 
I/flutter ( 6431): #143    _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter ( 6431): #144    RenderObject.layout 
I/flutter ( 6431): #145    _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter ( 6431): #146    RenderObject.layout 
I/flutter ( 6431): #147    _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter ( 6431): #148    RenderObject.layout 
I/flutter ( 6431): #149    _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter ( 6431): #150    RenderObject.layout 
I/flutter ( 6431): #151    _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter ( 6431): #152    RenderObject.layout 
I/flutter ( 6431): #153    _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter ( 6431): #154    RenderObject.layout 
I/flutter ( 6431): #155    RenderPadding.performLayout 
I/flutter ( 6431): #156    RenderObject.layout 
I/flutter ( 6431): #157    MultiChildLayoutDelegate.layoutChild 
I/flutter ( 6431): #158    _ScaffoldLayout.performLayout 
I/flutter ( 6431): #159    MultiChildLayoutDelegate._callPerformLayout 
I/flutter ( 6431): #160    RenderCustomMultiChildLayoutBox.performLayout 
I/flutter ( 6431): #161    RenderObject._layoutWithoutResize 
I/flutter ( 6431): #162    PipelineOwner.flushLayout 
I/flutter ( 6431): #163    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame 
I/flutter ( 6431): #164    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame 
I/flutter ( 6431): #165    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback 
I/flutter ( 6431): #166    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback 
I/flutter ( 6431): #167    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame 
I/flutter ( 6431): #168    _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame 
I/flutter ( 6431): #169    _invoke (dart:ui/hooks.dart:154:13)
I/flutter ( 6431): #170    _drawFrame (dart:ui/hooks.dart:143:3)
I/flutter ( 6431): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 6431): Another exception was thrown: A RenderFlex overflowed by 99770 pixels on the right.```
@zoechi
Copy link
Contributor

zoechi commented Jan 27, 2019

It's not clear what you try to accomplish.

Perhaps

isFavourite() {
    return wishListedUsers != null ? wishListedUsers.containsKey(id) : false;
}

Please consider asking support questions in one of the other channels listed at http://flutter.io/support .

@zoechi zoechi closed this as completed Jan 27, 2019
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants