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

Null check operator used on a null value #1

Open
Skyost opened this issue Mar 15, 2021 · 1 comment
Open

Null check operator used on a null value #1

Skyost opened this issue Mar 15, 2021 · 1 comment

Comments

@Skyost
Copy link
Contributor

Skyost commented Mar 15, 2021

Hey,
I've successfully implemented flutter_math in a RichText widget (see znjameswu/flutter_math#29 (comment)). But I still have some problems :

======== Exception caught by rendering library =====================================================
The following _CastError was thrown during performLayout():
Null check operator used on a null value

The relevant error-causing widget was: 
  RichText file:///D:/Hugo/Projets/Flutter/bacomathiques/lib/pages/html/widgets/math_widget.dart:41:12
When the exception was thrown, this was the stack: 
#0      MultiscriptsLayoutDelegate.performHorizontalIntrinsicLayout (package:flutter_math_fork/src/render/layout/multiscripts.dart:136:53)
#1      IntrinsicLayoutDelegate.performLayout (package:flutter_math_fork/src/render/layout/custom_layout.dart:266:19)
#2      RenderCustomLayout.performLayout (package:flutter_math_fork/src/render/layout/custom_layout.dart:198:27)
#3      RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#4      RenderLine.performLayout (package:flutter_math_fork/src/render/layout/line.dart:332:15)
...
The following RenderObject was being processed when the exception was fired: RenderCustomLayout<_ScriptPos>#19c04 relayoutBoundary=up35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  parentData: offset=Offset(0.0, 0.0); canBreakBefore = false; customSize = false; trailingMargin = 4.444444444444445; alignerOrSpacer = false (can use size)
...  constraints: BoxConstraints(unconstrained)
...  size: MISSING
RenderObject: RenderCustomLayout<_ScriptPos>#19c04 relayoutBoundary=up35 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
  parentData: offset=Offset(0.0, 0.0); canBreakBefore = false; customSize = false; trailingMargin = 4.444444444444445; alignerOrSpacer = false (can use size)
  constraints: BoxConstraints(unconstrained)
  size: MISSING
====================================================================================================

The problem seems to be the following line (in src/render/layout/multiscripts.dart) :

Screenshot_3

@Skyost
Copy link
Contributor Author

Skyost commented Mar 15, 2021

It seems it was just a problem with line breaking on \displaystyle{\int_1^4 2x + 1 \, \mathrm{d}x = \left[ x(x+1) \right]_1^4 = 4(4+1) - 1(1+1) = 20-2 = 18}. I have removed the displaystyle and it works.

I leave this issue opened in case you're interested but feel free to close it 😉

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

1 participant