joranmulderij / flutter_guitar_tabs

BSD 3-Clause "New" or "Revised" License
23 stars 11 forks source link

An error because of "Null check operator used on a null value" #9

Closed AbdullahNouvalShidqi closed 1 year ago

AbdullahNouvalShidqi commented 1 year ago

Hey @joranmulderij I think I found an error when the e string is muted on the tab as X, here's the message I got from the terminal


The following _CastError was thrown during paint():
Null check operator used on a null value

The relevant error-causing widget was:
  CustomPaint
  CustomPaint:file:///C:/Users/abdul/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_guitar_tabs-0.0.8/lib/flutter_guitar_tabs.d
  art:39:18

When the exception was thrown, this was the stack:
#0      _MyPainter.drawBars (package:flutter_guitar_tabs/flutter_guitar_tabs.dart:382:62)
#1      _MyPainter.draw (package:flutter_guitar_tabs/flutter_guitar_tabs.dart:351:10)
#2      _MyPainter.paint (package:flutter_guitar_tabs/flutter_guitar_tabs.dart:444:5)
#3      RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:571:13)
#4      RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:613:7)
#5      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#6      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#7      RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:144:15)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#10     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2924:15)
#11     RenderFlex.paint (package:flutter/src/rendering/flex.dart:1089:7)
#12     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#13     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#14     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2924:15)
#15     RenderFlex.paint (package:flutter/src/rendering/flex.dart:1089:7)
#16     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#17     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#18     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:144:15)
#19     RenderOffstage.paint (package:flutter/src/rendering/proxy_box.dart:3835:11)
#20     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#21     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#22     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2924:15)
#23     RenderStack.paintStack (package:flutter/src/rendering/stack.dart:654:5)
#24     RenderStack.paint (package:flutter/src/rendering/stack.dart:670:7)
#25     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#26     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#27     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2924:15)
#28     RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:415:5)
#29     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#30     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#31     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:144:15)
#32     _RenderInkFeatures.paint (package:flutter/src/material/material.dart:653:11)
#33     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#34     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#35     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:144:15)
#36     RenderPhysicalModel.paint.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2110:15)
#37     PaintingContext.pushClipRRect (package:flutter/src/rendering/object.dart:564:14)
#38     RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:2097:21)
#39     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#40     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:13)
#41     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:144:15)
#42     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2853:7)
#43     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:169:11)
#44     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:112:5)
#45     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1137:31)
#46     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:518:19)
#47     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:865:13)
#48     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:381:5)
#49     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1289:15)
#50     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1218:9)
#51     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1076:5)
#52     _invoke (dart:ui/hooks.dart:145:13)
#53     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:338:5)
#54     _drawFrame (dart:ui/hooks.dart:112:31)

The following RenderObject was being processed when the exception was fired: RenderCustomPaint#254e2:
  creator: CustomPaint ← ConstrainedBox ← Container ← Column ← FlutterGuitarTab ← Column ←
    Consumer<ChordViewModel> ← ChordScreen ← Offstage ← Stack ← KeyedSubtree-[GlobalKey#f469c] ←
    _BodyBuilder ← ⋯
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=180.0, h=150.0)
  size: Size(180.0, 150.0)
  painter: _MyPainter#24b6b()
This RenderObject has no descendants.```

I tried to fix it myself, but it seems to be I'm at my limit and I can't fix it.
joranmulderij commented 1 year ago

Thanks for noting this issue. I took a pause maintaining this package, but now I am trying to continue maintenance.

Just fixed this issue and published to pub.dev.