Skip to content

Support multiple windows for desktop shells #30701

Description

@stuartmorgan-g

See discussion in google/flutter-desktop-embedding#98

If we end up supporting multiple root views within one engine instance, this will require embedding API changes. If we don't, we'll need to have a viable strategy to recommend for coordinating between windows that works for cases that require constant synchronization (e.g., a tools palette in one window, with the canvas using those tools in another)

Activity

  1. added
    platform-macosBuilding on or for macOS specifically
    platform-windowsBuilding on or for Windows specifically
    platform-linuxBuilding on or for Linux specifically
    engineflutter/engine related. See also e: labels.
    on Apr 8, 2019
  2. rodydavis commented on May 2, 2019

    @rodydavis
    Contributor

    Maybe as a proof concept we could start with alert popups that open a separate window and can be dragged.

    Maybe like a Cupertino popover since they carry their own navigation internally on iPads.

    https://gist.github.com/AppleEducate/6f2a1188d6256b0eff79131891ce92f1

  3. stuartmorgan-g commented on May 2, 2019

    @stuartmorgan-g
    ContributorAuthor

    The place to start is agreement on, and design for, the technical approach that will be used to support multiple windows on desktop. A proof of concept can't come before a decision on what to build.

  4. rodydavis commented on May 2, 2019

    @rodydavis
    Contributor

    Very true. 👍🏼

  5. handicraftsman commented on May 11, 2019

    @handicraftsman

    In OpenGL applications there is a need to call a method called like MakeContextCurrent (different in every windowing API), thus i think it would be a nice idea to have some keyed contexts whose keys can be sent to the embedder to switch to the context. Although there is a problem with event handling - embedders would need to translate internal window system ids into context keys so flutter understands which window should receive the event. That means that both flutter and embedder must have 1-2 maps to identify the context keys.

  6. added this to the milestone on Aug 13, 2019
  7. GregorySech commented on Aug 26, 2019

    @GregorySech

    Does this have any implication on how web handles multiple tabs?

  8. 171 remaining items

  9. stan-at-work commented on Feb 4, 2025

    @stan-at-work
  10. stuartmorgan-g commented on Feb 4, 2025

    @stuartmorgan-g
    Author
  11. FMorschel commented on Feb 4, 2025

    @FMorschel
  12. stan-at-work commented on Feb 4, 2025

    @stan-at-work
  13. orestesgaolin commented on Oct 27, 2025

    @orestesgaolin
    Contributor

    For anyone getting redirected here from this error message:

    The following UnsupportedError was thrown attaching to the render tree:
    Unsupported operation: Windowing APIs are not enabled.
    
    Windowing APIs are currently experimental. Do not use windowing APIs in
    production applications or plugins published to pub.dev.
    
    To try experimental windowing APIs:
    1. Switch to Flutter's main release channel.
    2. Turn on the windowing feature flag.
    
    See: https://github.com/flutter/flutter/issues/30701.
    

    This is how you enable windowing feature flag:

    flutter config --enable-windowing
    Image
  14. kaduvert commented on Jun 4, 2026

    @kaduvert

    some error logs on GNOME/wayland with the example from above:

    logs
    ❯ /home/kaduvert/Schreibtisch/flutter/bin/flutter run --debug -d linux
    Launching lib/main.dart on Linux in debug mode...
    Building Linux application...                                           
    ✓ Built build/linux/x64/debug/bundle/multiple_windows
    Gdk-Message: 13:47:12.990: Unable to load  from the cursor theme
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:13.038: invalid (NULL) pointer instance
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:13.038: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
    Gdk-Message: 13:47:13.048: Unable to load  from the cursor theme
    Syncing files to device Linux...                                    29ms
    
    Flutter run key commands.
    r Hot reload. 🔥🔥🔥
    R Hot restart.
    h List all available interactive commands.
    d Detach (terminate "flutter run" but leave application
    running).
    c Clear the screen
    q Quit (terminate the application on the device).
    
    A Dart VM Service on Linux is available at:
    http://127.0.0.1:45347/g3iis-GNeWI=/
    The Flutter DevTools debugger and profiler on Linux is
    available at:
    http://127.0.0.1:45347/g3iis-GNeWI=/devtools/?uri=ws://127.0
    .0.1:45347/g3iis-GNeWI=/ws
    
    ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY
    ╞═══════════════════════════════════════════════
    ══════════
    The following assertion was thrown during
    layout:
    A RenderFlex overflowed by 888 pixels on the
    bottom.
    
    The relevant error-causing widget was:
      AlertDialog
      AlertDialog:file:///home/kaduvert/Downloads/mu
      ltiple_windows/lib/app/regular_window_edit_dia
      log.dart:143:12
    
    To inspect this widget in Flutter DevTools,
    visit:
    http://127.0.0.1:45347/g3iis-GNeWI=/devtools//#/
    inspector?uri=http%3A%2F%2F127.0.0.1%3A45347%2Fg
    3iis-GNeWI%3D%2F&inspectorRef=inspector-0
    
    The overflowing RenderFlex has an orientation of
    Axis.vertical.
    The edge of the RenderFlex that is overflowing
    has been marked in the rendering with a yellow
    and
    black striped pattern. This is usually caused by
    the contents being too big for the RenderFlex.
    Consider applying a flex factor (e.g. using an
    Expanded widget) to force the children of the
    RenderFlex to fit within the available space
    instead of being sized to their natural size.
    This is considered an error condition because it
    indicates that there is content that cannot be
    seen. If the content is legitimately bigger than
    the available space, consider clipping it with a
    ClipRect widget before putting it in the flex,
    or using a scrollable container rather than a
    Flex,
    like a ListView.
    The specific RenderFlex in question is:
    RenderFlex#557d3 OVERFLOWING:
      needs compositing
      creator: Column ← IntrinsicWidth ← Semantics ←
      DefaultTextStyle ← AnimatedDefaultTextStyle ←
        _InkFeatures-[GlobalKey#6d287 ink renderer]
        ←
        NotificationListener<LayoutChangedNotificati
        on> ←
        CustomPaint ← _ShapeBorderPaint ←
        PhysicalShape ← _MaterialInterior ← Material
        ← ⋯
      parentData: <none> (can use size)
      constraints: BoxConstraints(w=0.5, h=0.5)
      size: Size(0.5, 0.5)
      direction: vertical
      mainAxisAlignment: start
      mainAxisSize: min
      crossAxisAlignment: stretch
      verticalDirection: down
      spacing: 0.0
    ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
    ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
    ◢◤◢◤
    ════════════════════════════════════════════════
    ════════════════════════════════════════════════
    ════
    
    Another exception was thrown: A RenderFlex
    overflowed by 272 pixels on the bottom.
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:51.713: invalid (NULL) pointer instance
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:51.713: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:53.000: invalid (NULL) pointer instance
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:53.000: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:57.232: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:47:57.232: gtk_widget_get_allocation: assertion 'GTK_IS_WIDGET (widget)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:57.232: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:47:57.232: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed
    
    ** (com.example.multiple_windows:44480): CRITICAL **: 13:47:57.232: void fl_compositor_get_frame_size(FlCompositor *, size_t *, size_t *): assertion 'FL_IS_COMPOSITOR(self)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:47:57.232: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:47:57.232: gtk_widget_queue_draw: assertion 'GTK_IS_WIDGET (widget)' failed
    Another exception was thrown: A RenderFlex
    overflowed by 15 pixels on the bottom.
    Another exception was thrown: A RenderFlex
    overflowed by 8.0 pixels on the bottom.
    Another exception was thrown: A RenderFlex
    overflowed by 19 pixels on the right.
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:48:14.851: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:48:14.851: gtk_widget_get_allocation: assertion 'GTK_IS_WIDGET (widget)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:48:14.851: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:48:14.851: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed
    
    ** (com.example.multiple_windows:44480): CRITICAL **: 13:48:14.851: void fl_compositor_get_frame_size(FlCompositor *, size_t *, size_t *): assertion 'FL_IS_COMPOSITOR(self)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:48:14.851: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:48:14.851: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:48:14.851: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:48:14.851: gtk_widget_get_toplevel: assertion 'GTK_IS_WIDGET (widget)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:48:16.166: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:48:16.166: gtk_widget_get_allocation: assertion 'GTK_IS_WIDGET (widget)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:48:16.166: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:48:16.166: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed
    
    ** (com.example.multiple_windows:44480): CRITICAL **: 13:48:16.166: void fl_compositor_get_frame_size(FlCompositor *, size_t *, size_t *): assertion 'FL_IS_COMPOSITOR(self)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:48:16.166: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:48:16.166: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed
    
    (com.example.multiple_windows:44480): GLib-GObject-CRITICAL **: 13:48:16.166: invalid unclassed pointer in cast to 'GtkWidget'
    
    (com.example.multiple_windows:44480): Gtk-CRITICAL **: 13:48:16.166: gtk_widget_get_toplevel: assertion 'GTK_IS_WIDGET (widget)' failed
    Another exception was thrown: A RenderFlex
    overflowed by 402 pixels on the bottom.
    Another exception was thrown: A RenderFlex
    overflowed by 402 pixels on the bottom.
    

    recording of how the logs came about to aid with diagnosing:

    multiple.windows.mp4
  15. orestesgaolin commented on Jun 17, 2026

    @orestesgaolin
    Contributor

    Support for multiple windows has gotten pretty solid recently. I built a demo using LLM and must admit this looks really promising.

    Image
  16. Gorniv commented on Sep 1, 2026

    @Gorniv

    Thanks for publishing Introducing the Desktop Windowing API for Flutter. I couldn’t find the article linked in this tracking issue, so I’m adding it here for subscribers who may have missed it.

    One migration question for apps currently using window_manager: the experimental API shown in the article covers title, size, constraints, activation, maximize/minimize/fullscreen, and window lifecycle, but I couldn’t find per-window equivalents for:

    • reading the current position (getPosition)
    • setting the position or bounds (setPosition / setBounds)
    • receiving move notifications (onWindowMoved)

    These capabilities are important for persisting and restoring each window’s placement, especially in multi-monitor setups. window_manager provides them for the existing main/implicit window, but it doesn’t appear to provide a migration path for every framework-created window.

    Are per-window position/bounds APIs and move notifications planned? Where a platform does not allow applications to control absolute window placement, best-effort semantics or an explicit unsupported result would still be useful, along with guidance on whether applications should temporarily retain window_manager or native platform code.

  17. stan-at-work commented on Sep 1, 2026

    @stan-at-work
  18. mauricev commented on Sep 1, 2026

    @mauricev

    Plus the ability to open a window hidden (transparent windows, too?) and of course the black window bug on Mac OS, #184701 (comment)

  19. saviq-work commented on Sep 2, 2026

    @saviq-work

    The approach we're taking is more towards abstracting higher level functionality away. So as an app developer, you wouldn't get/setPosition (exactly because not all platforms support it, by design - and what even is the position in a AR/VR environment?). You can already control child window placement via the positioner interfaces. Instead of global positioning, we'll add functionality to automatically restore window positions on platforms that need it - and defer to the system where that's the platform's approach.

    Similarly, for window move events - those have to be limited to relative positions in parent/child relationships rather than global positions, the primary use case being docking/undocking toolboxes within the main window.

    For hidden / transparent windows, it would be great to understand the use cases so we can design it well.

    So generally when discussing these, would you please file separate feature requests for higher level functionality and add as many use cases you can think of. Add the a: multi window label so it doesn't get lost.

    Thanks for the feedback, all!

  20. mauricev commented on Sep 2, 2026

    @mauricev

    I create a feature request here, #192188, but I don't see how to add the proper label.

  21. Razorex001 commented on Sep 5, 2026

    @Razorex001

    @saviq-work I can provide a real example of hidden/transparent windows use case in private, if you want.
    In my case I had to opt for a hybrid design based on what I understood possible currently, so in my app I have the overlay surface created through Flutter’s multi-window api, but transparency, always-on-top, no-activate, click-through, reveal/hide, and cursor polling are implemented with native Win32 code.
    I would have preferred if all what I needed could have been supported in flutter as part of the higher level functionality you were talking about.
    It's a bit hard for me to file proper issues for these though as I don't really want to share details of my project publicly at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: desktopRunning on desktopa: multi windowIssues related to multi window supportc: new featureNothing broken; request for a new capabilitycustomer: chalk (g3)customer: crowdAffects or could affect many people, though not necessarily a specific customer.engineflutter/engine related. See also e: labels.platform-linuxBuilding on or for Linux specificallyplatform-macosBuilding on or for macOS specificallyplatform-windowsBuilding on or for Windows specificallyteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions