akbarpulatov / flutter_awesome_select

Forked from https://github.com/davigmacode/flutter_smart_select, updated legacy code, migrated to null safety and more. AwesomeSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice.
https://pub.dev/packages/awesome_select
MIT License
48 stars 56 forks source link

Unhandled Exception: A S2Choices<Abc?> was used after being disposed #8

Closed absar closed 3 years ago

absar commented 3 years ago

Occasionally tapping the tile 2 to 3 times to open bottom sheet throws Unhandled Exception: A S2Choices<Abc?> was used after being disposed. Once you have called dispose() on a S2Choices<Abc?>, it can no longer be used. The culprit is S2Choices.load finally { await Future.delayed(delay ?? const Duration(milliseconds: 300), () { task = null; notifyListeners(); }); }

It seems to be the same issue in original repository: https://github.com/davigmacode/flutter_smart_select/issues/74

Log E/flutter ( 7710): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: A S2Choices was used after being disposed. E/flutter ( 7710): Once you have called dispose() on a S2Choices, it can no longer be used. E/flutter ( 7710): ChangeNotifier._debugAssertNotDisposed. (package:flutter/src/foundation/change_notifier.dart:114:9) E/flutter ( 7710): ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:120:6) E/flutter ( 7710): ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:288:12) E/flutter ( 7710): S2Choices.notifyListeners (package:awesome_select/src/state/choices.dart:210:13) E/flutter ( 7710): S2Choices.load. (package:awesome_select/src/state/choices.dart:140:9) E/flutter ( 7710): new Future.delayed. (dart:async/future.dart:315:39) E/flutter ( 7710): _rootRun (dart:async/zone.dart:1420:47) E/flutter ( 7710): _CustomZone.run (dart:async/zone.dart:1328:19) E/flutter ( 7710): _CustomZone.runGuarded (dart:async/zone.dart:1236:7) E/flutter ( 7710): _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1276:23) E/flutter ( 7710): _rootRun (dart:async/zone.dart:1428:13) E/flutter ( 7710): _CustomZone.run (dart:async/zone.dart:1328:19) E/flutter ( 7710): _CustomZone.bindCallback. (dart:async/zone.dart:1260:23) E/flutter ( 7710): Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) E/flutter ( 7710): _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19) E/flutter ( 7710): _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5) E/flutter ( 7710): _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)