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

This widget has been unmounted, so the State no longer has a context (and should be considered defunct). #482

Open
hkaikai opened this issue Jul 2, 2024 · 3 comments

Comments

@hkaikai
Copy link

hkaikai commented Jul 2, 2024

when I wrap the Slidable component with the SlidableAutoCloseBehavior component, closing the ActionPane throws an error

flutter:3.7
flutter_slidable:3.1.0
ios simulator:15 pro max(ios 17.5)

════════ Exception caught by animation library ═════════════════════════════════
The following assertion was thrown while notifying status listeners for AnimationController:
This widget has been unmounted, so the State no longer has a context (and should be considered defunct).

Consider canceling any active work during "dispose" or using the "mounted" getter to determine if the State is still active.
When the exception was thrown, this was the stack
#0      State.context.<anonymous closure>
framework.dart:947
#1      State.context
framework.dart:953
#2      _SlidableAutoCloseBarrierNotificationSenderState._handleStatusChanged
auto_close_behavior.dart:362
#3      _SlidableNotificationSenderState.handleStatusChanged
auto_close_behavior.dart:533
#4      AnimationLocalStatusListenersMixin.notifyStatusListeners
listener_helpers.dart:240
#5      AnimationController._checkStatusChanged
animation_controller.dart:822
#6      AnimationController.value=
animation_controller.dart:370
#7      SlidableController.ratio=
controller.dart:215
#8      _SlidableGestureDetectorState.handleDragUpdate
gesture_detector.dart:90
#9      DragGestureRecognizer._checkUpdate.<anonymous closure>
monodrag.dart:483
#10     GestureRecognizer.invokeCallback
recognizer.dart:253
#11     DragGestureRecognizer._checkUpdate
monodrag.dart:483
#12     DragGestureRecognizer.handleEvent
monodrag.dart:330
#13     PointerRouter._dispatch
pointer_router.dart:98
#14     PointerRouter._dispatchEventToRoutes.<anonymous closure>
pointer_router.dart:143
#15     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
#16     PointerRouter._dispatchEventToRoutes
pointer_router.dart:141
#17     PointerRouter.route
pointer_router.dart:127
#18     GestureBinding.handleEvent
binding.dart:460
#19     GestureBinding.dispatchEvent
binding.dart:440
#20     RendererBinding.dispatchEvent
binding.dart:336
#21     GestureBinding._handlePointerEventImmediately
binding.dart:395
#22     GestureBinding.handlePointerEvent
binding.dart:357
#23     GestureBinding._flushPointerEventQueue
binding.dart:314
#24     GestureBinding._handlePointerDataPacket
binding.dart:295
#25     _invoke1 (dart:ui/hooks.dart:164:13)
#26     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:361:7)
#27     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:31)
The AnimationController notifying status listeners was: AnimationController#43b2a(▶ 0.038; paused)
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by animation library ═════════════════════════════════
This widget has been unmounted, so the State no longer has a context (and should be considered defunct).
════════════════════════════════════════════════════════════════════════════════
@letsar
Copy link
Owner

letsar commented Jul 11, 2024

Hi, can you provide a simple example code to reproduce this issue?

@shahmirzali49
Copy link

same error :/

@shahmirzali49
Copy link

I added key to SlidableAutoCloseBehavior and error gone.

 child: SlidableAutoCloseBehavior(
                                  key: const ValueKey(
                                      "slidableAutoCloseBehavior"),
                                  child: ListView.separated(
                                    controller: scrollController,

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

3 participants