You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native sheet/dialog dismissal via gesture or scrim tap does not complete Future or notify PopScope #32
I searched the existing feature requests and this is not a duplicate.
Framework or plugin?
Framework
Platform
Both
Use case
Problem
When dismissing a native sheet or dialog interactively (dragging down the grabber/detent or tapping the backdrop scrim), Dart is not notified:
The Future returned by showModalSheet / showModalBottomSheet / showDialog never completes.
PopScope.onPopInvokedWithResult is not triggered.
Programmatic Navigator.pop(context) works, but gesture/scrim dismissal leaves the Dart Future hanging, making it impossible for routers or state management to detect that the modal was closed.
Expose transition/dismissal life-cycle via a Controller:
Allow passing a controller (e.g. SheetController or NativePresentationHandle) that emits dismiss and completion events.
Align with Flutter's modal route lifecycle:
Ensure native presentation wrappers hook into the native UIAdaptivePresentationControllerDelegate (iOS) / OnBackPressedDispatcher or bottom sheet dialog callbacks (Android) to complete the bridge Completer on dismiss.
On PopScope you are right, and we can confirm it. PopScope is honoured on
route pops, but an interactive dismissal completes the result and tears
the presentation down without consulting the active PopScope entries, so
onPopInvokedWithResult never runs for a swipe or scrim tap. We will fix it.
On the Future we read the code differently, so we want to be sure before
we change anything. All three functions install a native dismissal
callback that completes the Future with null: on iOS through the system's
dismissal delegate for a page sheet and the overlay's own tap and pan
handling for the bottom sheet, on Android through the sheet's and the
dialog's dismiss listeners. So a gesture or scrim dismissal should
already complete it on both platforms.
Have you seen it hang in a running app, or is this from reading the API?
If you have seen it, please share a small repository that reproduces it,
with a log from the failing run, plus your DartNative version and how you
dismissed the sheet. The dismissal path prints a line under the dartnative
name beginning "[DN-Dart] onDismissed fired": if it is missing when you
dismiss, the problem is below Dart, and if it is there while your Future
is pending, the problem is above it.
Of your three proposals we would take the third. Hooking the native
presentation into the route lifecycle fixes PopScope and anything else
that depends on the route contract, instead of adding a parallel callback
to each function.
I'm implementing routing library for dartnative and i want unify sheet with normal page. The problem is sheet doesn't have reliable way to notify router that they're dismissed. :-)
I'm implementing routing library for dartnative and i want unify sheet with normal page. The problem is sheet doesn't have reliable way to notify router that they're dismissed. :-)
Have you (anyone) tried making a custom implementation on top of kaisel_core to handle this kind of routing logic?
I'm the author of zenrouter so i prepared zenrouter_core as an infrastructure for zenrouter_dartnative. I want to make sure the routing experience will smooth as much as possible. Kaisel is a great one too. It's learned from zenrouter and using fairly different style to construct route. Zenrouter 3.0 also support that kind of style too so you will have best of both world :-)
Thank you! This is integrated and will be available in the upcoming framework release. We’ll close this once the new release is published.
We took your third proposal. A PopScope inside showModalSheet, showModalBottomSheet or showDialog now follows the modal route contract on both platforms: canPop: false keeps the presentation up against the swipe, the tap outside and the system back, and onPopInvokedWithResult hears every attempt (didPop false) and every close (didPop true, with the result passed to Navigator.pop), before the Future completes. Your router can rely on either the callback or the Future.
Activity
mikijg commentedon Sep 17, 2026
Thanks for the detailed write-up!
On PopScope you are right, and we can confirm it. PopScope is honoured on
route pops, but an interactive dismissal completes the result and tears
the presentation down without consulting the active PopScope entries, so
onPopInvokedWithResult never runs for a swipe or scrim tap. We will fix it.
On the Future we read the code differently, so we want to be sure before
we change anything. All three functions install a native dismissal
callback that completes the Future with null: on iOS through the system's
dismissal delegate for a page sheet and the overlay's own tap and pan
handling for the bottom sheet, on Android through the sheet's and the
dialog's dismiss listeners. So a gesture or scrim dismissal should
already complete it on both platforms.
Have you seen it hang in a running app, or is this from reading the API?
If you have seen it, please share a small repository that reproduces it,
with a log from the failing run, plus your DartNative version and how you
dismissed the sheet. The dismissal path prints a line under the dartnative
name beginning "[DN-Dart] onDismissed fired": if it is missing when you
dismiss, the problem is below Dart, and if it is there while your Future
is pending, the problem is above it.
Of your three proposals we would take the third. Hooking the native
presentation into the route lifecycle fixes PopScope and anything else
that depends on the route contract, instead of adding a parallel callback
to each function.
definev commentedon Sep 17, 2026
I'm implementing routing library for dartnative and i want unify sheet with normal page. The problem is sheet doesn't have reliable way to notify router that they're dismissed. :-)
definev commentedon Sep 18, 2026
@mikijg I've added the reproduction repo in the issue. You can check by three step:
It's only happen in ios, android works fine
mikijg commentedon Sep 18, 2026
Thank you! We’ll look into this soon and plan to fix it in the next framework release, coming next week.
definev commentedon Sep 20, 2026
I'm the author of zenrouter so i prepared zenrouter_core as an infrastructure for zenrouter_dartnative. I want to make sure the routing experience will smooth as much as possible. Kaisel is a great one too. It's learned from zenrouter and using fairly different style to construct route. Zenrouter 3.0 also support that kind of style too so you will have best of both world :-)
mikijg commentedon Sep 22, 2026
We’re coding, and we’ll try to integrate this feature request as well. We may reach out to you on X for quick communication if needed.
Thank you for helping make DN great!
mikijg commentedon Sep 23, 2026
Thank you! This is integrated and will be available in the upcoming framework release. We’ll close this once the new release is published.
We took your third proposal. A PopScope inside showModalSheet, showModalBottomSheet or showDialog now follows the modal route contract on both platforms: canPop: false keeps the presentation up against the swipe, the tap outside and the system back, and onPopInvokedWithResult hears every attempt (didPop false) and every close (didPop true, with the result passed to Navigator.pop), before the Future completes. Your router can rely on either the callback or the Future.
definev commentedon Sep 23, 2026
Thank you :-) It's a great news 💙