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

test(DropDownAlert): add unit test #2

Merged

Conversation

trunghieuvn
Copy link
Contributor

@trunghieuvn trunghieuvn commented Jul 2, 2021

Hi @vantuan88291 thank for your package.

please review unit test here and fix some issue can't render because timer not init

@override
  void dispose() {
    super.dispose();
    _controller?.dispose();
    _controller = null;
    _timer!.cancel();
    _timerRelay!.cancel();
  }

Screen Shot 2021-07-02 at 9 26 50 AM

@trunghieuvn
Copy link
Contributor Author

log error if not workaround

AlertController was created!
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _CastError was thrown while finalizing the widget tree:
Null check operator used on a null value

When the exception was thrown, this was the stack:
#0      DropdownAlertWidget.dispose (package:flutter_dropdown_alert/dropdown_alert.dart:228:11)
#1      StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4800:11)
#2      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1847:13)
#3      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#4      MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6185:16)
#5      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#6      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#7      ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#8      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#9      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#10     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#11     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#12     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#13     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#14     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#15     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#16     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#17     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#18     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#19     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#20     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#21     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#22     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#23     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#24     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#25     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#26     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#27     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#28     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#29     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#30     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#31     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#32     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#33     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#34     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#35     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#36     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#37     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#38     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#39     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#40     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#41     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#42     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#43     SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6070:14)
#44     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#45     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#46     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#47     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#48     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#49     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#50     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#51     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#52     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#53     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#54     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#55     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#56     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#57     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#58     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#59     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#60     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#61     SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6070:14)
#62     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#63     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#64     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#65     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#66     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#67     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#68     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#69     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#70     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#71     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#72     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#73     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#74     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#75     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#76     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#77     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#78     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#79     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#80     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#81     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#82     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#83     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#84     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#85     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#86     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#87     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#88     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#89     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#90     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#91     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#92     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#93     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#94     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#95     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#96     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#97     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#98     _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#99     _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#100    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6070:14)
#101    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#102    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#103    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#104    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#105    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#106    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#107    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#108    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#109    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#110    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#111    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#112    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#113    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#114    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#115    SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6070:14)
#116    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#117    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#118    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#119    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#120    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#121    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#122    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#123    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#124    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#125    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#126    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#127    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#128    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#129    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#130    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#131    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#132    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#133    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#134    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#135    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#136    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#137    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#138    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#139    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#140    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#141    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#142    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#143    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#144    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#145    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#146    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#147    _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1845:7)
#148    ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4628:14)
#149    _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1843:13)
#150    ListIterable.forEach (dart:_internal/iterable.dart:39:13)
#151    _InactiveElements._unmountAll (package:flutter/src/widgets/framework.dart:1856:25)
#152    BuildOwner.finalizeTree.<anonymous closure> (package:flutter/src/widgets/framework.dart:2840:27)
#153    BuildOwner.lockState (package:flutter/src/widgets/framework.dart:2473:15)
#154    BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:2839:7)
#155    AutomatedTestWidgetsFlutterBinding.drawFrame (package:flutter_test/src/binding.dart:1126:19)
#156    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:328:5)
#157    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#158    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#159    AutomatedTestWidgetsFlutterBinding.scheduleWarmUpFrame (package:flutter_test/src/binding.dart:1052:5)
#160    runApp (package:flutter/src/widgets/binding.dart:1029:7)
#161    TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:800:7)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:02 +0 -1: description WHEN open screen LoginScreen, THEN should render basic successfully [E]                                                                                                                               
  Test failed. See exception logs above.
  The test description was: WHEN open screen LoginScreen, THEN should render basic successfully
  
00:02 +0 -1: Some tests failed.                                                                                                                                                                                                
TrungHieu:flutter_dropdown_alert macbookpro$ 

@vantuan88291 vantuan88291 merged commit 2bdd247 into vantuan88291:master Sep 18, 2021
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

Successfully merging this pull request may close these issues.

2 participants