rickywen911/custom_bubble_navigation_bar

Exception while testing

Closed this issue · 8 comments

I am getting this exception when testing my application with your navigation included. Which does not happen if I use a different one. Yet, I couldn't figure out the issue. The dispose() method is not getting called in the CostumeNavigationBarState when I debug it. Since, I am new to flutter you might have a better idea, where this comes from.

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following NoSuchMethodError was thrown while finalizing the widget tree:
The method 'dispose' was called on null.
Receiver: null
Tried calling: dispose()

When the exception was thrown, this was the stack:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 _CustomNavigationBarState.dispose (package:custom_navigation_bar/src/custome_navigation_bar.dart:149:17)
#2 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4435:12)
#3 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1748:13)
#4 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#5 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5433:14)
#6 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#7 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#8 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5433:14)
#9 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#10 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#11 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5433:14)
#12 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#13 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#14 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4272:14)
#15 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#16 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#17 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5433:14)
#18 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#19 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#20 MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5534:16)
#21 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#22 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#23 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4272:14)
#24 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#25 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#26 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4272:14)
#27 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#28 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#29 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4272:14)
#30 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#31 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#32 MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5534:16)
#33 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#34 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#35 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4272:14)
#36 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#37 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#38 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4272:14)
#39 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#40 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#41 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4272:14)
#42 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#43 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#44 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5433:14)
#45 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#46 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#47 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4272:14)
#48 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1744:13)
#49 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1746:7)
#50 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5433:14)
...
(elided 28 frames from class _FakeAsync, package dart:async, package dart:async-patch, and package stack_trace)
════════════════════════════════════════════════════════════════════════════════════════════════════

@JonathanIsCodeing Thanks for using my package. Can you please send me a code example of how you using this navigation bar so I can locate the issue?

I made a repo with the code part which is causing this issue:
example code

@JonathanIsCodeing Thanks, I will check it and locate the issue.

@JonathanIsCodeing I'm sorry, based on your example, I'm not able to reproduce the error, can you please tell me the process how you produce the error?

@rickywen911 It happens when I run the example test I created.
Otherwise the code runs fine in the app.

@JonathanIsCodeing Hi, I have located the issue, it seems that when run test_widget, the didUpdateWidget method is not getting called. So it will generate a null point exception. I will fix it in the new version.

Fixed, close for now.

Thank you for the effort!