Skip to content

Multi-Window Pre-launch Checklist #177586

Open
0 of 2 issues completed
Open

Description

@mattkae

Use case

Multi-window is currently hidden behind a feature flag. Before we officially release it for public consumption, we need to fix a few things.

Proposal

Checklist

  • Remove TODOs from example code snippets in _window.dart
  • Remove invalid_use_of_internal_member ignore comment from examples when the API is stable.
  • Update the runner to not show a window by default, and make runApp initialize the main native window

Activity

  1. self-assigned this
    on Oct 27, 2025
  2. rk54rk commented on Dec 7, 2025

    @rk54rk

    Hey I wonder is there a very rough estimate on when the multi-window features would go live (in dev/beta channel)? Not trying to pressure you guys, just wanted to pace my own project. Thanks! ✨

  3. mattkae commented on Dec 11, 2025

    @mattkae
    ContributorAuthor

    Hey I wonder is there a very rough estimate on when the multi-window features would go live (in dev/beta channel)? Not trying to pressure you guys, just wanted to pace my own project. Thanks! ✨

    Hi there. It's a bit difficult to judge at the moment. The work is moving swiftly now, but there is still a good chunk left to complete. The windowing features are currently live behind the feature flag, which you can enable with:

    flutter config --enable-windowing
    

    Most of those windowing APIs are stable. They will only change in response to user feedback (which could include yours 😄).

  4. momadvisor commented on Dec 14, 2025

    @momadvisor

    Hey I wonder is there a very rough estimate on when the multi-window features would go live (in dev/beta channel)? Not trying to pressure you guys, just wanted to pace my own project. Thanks! ✨

    Hi there. It's a bit difficult to judge at the moment. The work is moving swiftly now, but there is still a good chunk left to complete. The windowing features are currently live behind the feature flag, which you can enable with:

    flutter config --enable-windowing
    

    Most of those windowing APIs are stable. They will only change in response to user feedback (which could include yours 😄).

    The windowing APIs cannot yet be used in applications because they can only be run using runWidget. Although it's not shown in the examples, after various attempts and struggles, I found that by using ViewAnchor and ViewCollection, it is possible to use the windowing APIs together with runApp. However, due to the characteristics of ViewAnchor, the app cannot be used normally.
    Is there a way to properly use the windowing APIs with runApp? I'd really appreciate any advice or guidance!

  5. rk54rk commented on Dec 15, 2025

    @rk54rk

    @mattkae
    I'm able to get it work on macOS (on Windows there is always a LateInitializationError when running example I'm not sure why). The API feels great! I think it could be nice to also be able to set window position and focus in RegularWindowController. Greedy me! 😄

    Also, do you guys think there could be some kind of handle/tagging mechanisms so that the windows can be accessed from the native code? I'm thinking more advanced customisations like giving different windows different frames or modes of interactions. Or is this doable with the current API?

    @momadvisor did the example run? When working with an existed app, I did find it necessary to remove MainFlutterWindow.swift from the xcode runner, also replace MainMenu.xib and adapt AppDelegate.swift according to the example app. After that my app runs with runWidget following the example pattern.

  6. momadvisor commented on Dec 16, 2025

    @momadvisor

    @rk54rk
    I ran the example. It works well and is nice. The example works properly because it depends only on runWidget. However, runWidget cannot be used in production apps. Production apps must use runApp, and in that case the windowing APIs cannot be used in reality. Other than the approach that leverages the previously mentioned ViewCollection + ViewAnchor, I haven’t been able to find a solution. Although the windowing APIs were implemented quite some time ago, in my opinion it will still take a long time before they see a real-world usage.

  7. rk54rk commented on Dec 19, 2025

    @rk54rk

    @mattkae
    A bit of update from test driving the windowing API:

    I was trying to create an multi-window app with:

    • different window styles (normal/borderless).
    • custom borderless window with custom close/maximize/minimize buttons and still draggable.
    • set window position at creation.
    • set window position and size after creation.
    • inform dart side latest window size/position.

    The new API currently doesn't support most of these features out of the box, so I was trying to make a custom swift plugin to do these, then communicate with dart using something like:

    class MacosWindowPlugin {
      static const _channel = MethodChannel('custom_window_plugin');
      static final _metricsController = StreamController<WindowMetrics>.broadcast();
      static Stream<WindowMetrics> get metricsStream => _metricsController.stream;
      static bool _initialized = false;
    
      Stream<WindowMetrics> get metricsStream;
      Future<void> initialize();
      Future<void> registerCurrentWindow(String logicalId);
      Future<void> makeWindowBorderless(String logicalId);
      Future<void> startDrag(String logicalId);
      Future<void> setWindowMetrics({
        required String logicalId,
        required Offset position,
        required Size size,
      });
      Future<void> centerWindow(String logicalId);
      ...
    }
    
    

    Then most of the features can be achieved this way.

    However, with the current API, I had to match a dart side handle with the native window RIGHT AFTER the native window were created by the engine, by using the swift plugin to do something like "get the current key window" or "find the first NSWindow that we don't yet know about", which can be very fragile and racy.

    Also any customise/styling/positioning by the swift plugin have to run AFTER the engine have already created the window. If I want to create a custom window at a custom position right from the beginning, there will be a visual jump which is hard to get rid of.

    So I wonder if it is possible to add a mechanism to run the "custom initialisation" with swift code before the engine creates any window – something like MainFlutterWindow.swift, but for multi-window? Also, would it be cool to introduce a way to allow deterministrically match/handle native windows in dart/swift land? Not sure if this makes sense, let me know what you think! 😋

    @momadvisor
    From my brief test drive it seems my app runs fine with runWidget, not sure why "production apps must use runApp", but I'm interested to know!

  8. dev-solo-game commented on Dec 26, 2025

    @dev-solo-game

    examples\multiple_windows example: creating a new window on windows will result in an error LateInitializationError

  9. ilsubyeega commented on Jan 7, 2026

    @ilsubyeega

    FWIW i believe examples/multiple_windows should implement dialog and popup(layer) view, which canonical previously showed before.

    Image
  10. wanjm commented on Jan 19, 2026

    @wanjm

    currently, regular window, dialog window, tooltips are commited; doesn't it mean there is only context left (is context used for popup menu of right key of mouse);

    is it in progress now ? or is there more high priority works which may delay it;

  11. mattkae commented on Jan 20, 2026

    @mattkae
    ContributorAuthor

    So I wonder if it is possible to add a mechanism to run the "custom initialisation" with swift code before the engine creates any window – something like MainFlutterWindow.swift, but for multi-window? Also, would it be cool to introduce a way to allow deterministrically match/handle native windows in dart/swift land? Not sure if this makes sense, let me know what you think! 😋

    We have some ideas about adding initialization customizability (I've been experimenting with this in Linux myself), but it may be a bit of time/work to land them after we get the initial window types and concepts down. This is definitely on our radar though 😄

    @momadvisor From my brief test drive it seems my app runs fine with runWidget, not sure why "production apps must use runApp", but I'm interested to know!

    runWidget is the only way to make things work for now. In the future, runApp will probably be refactored to spawn a true regular window by default, so that developers can use runApp with other windows.

  12. jdcryer commented on Apr 23, 2026

    @jdcryer

    I am very new to Flutter and kept hearing Flutter cannot do SDI. This is an awesome initiative. The one and only issue I hit was drag drop from a chiled window to the master. Had to implement a click to place alternative. Would be good to know if this is on the roadmap but otherwies truly impressive addition to the desktop space.

    Edit: I think I found the answer in super_drag_and_drop.

  13. mattkae commented on May 5, 2026

    @mattkae
    ContributorAuthor

    I am very new to Flutter and kept hearing Flutter cannot do SDI. This is an awesome initiative. The one and only issue I hit was drag drop from a chiled window to the master. Had to implement a click to place alternative. Would be good to know if this is on the roadmap but otherwies truly impressive addition to the desktop space.

    Edit: I think I found the answer in super_drag_and_drop.

    Glad to hear its working well for you!

    Do you have a code snippet for what's not working there? That might be a good thing to solve as a separate ticket if it's not working with multi window.

  14. jdcryer commented on May 5, 2026

    @jdcryer

    Do you have a code snippet for what's not working there? That might be a good thing to solve as a separate ticket if it's not working with multi window.

    Super drag and drop solved the issues I was having. I had initial concerns that it was an external package but then read that it is the definitive solution recommended by the flutter team so that was the answer.

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

Metadata

Metadata

Assignees

Labels

a: multi windowIssues related to multi window support

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions