r/flutterhelp • • 8d ago

OPEN Flutter 3.50 Linux app shows black screen on Sway/Wayland, but works on Ubuntu desktop

Hi everyone,

I'm experiencing a rendering issue after upgrading my Flutter Linux application to Flutter 3.50.

The application works perfectly on my Ubuntu development laptop, but on our production device (CoreBox), which runs Sway with native Wayland, the application starts successfully but displays a black/blue screen.

The interesting part is that the application itself seems to be running normally. All services initialize, gRPC connections work, assets are loaded, and the application processes data without any obvious errors.

Environment:

  • OS: Ubuntu 26.04.1 LTS
  • Kernel: 7.0.0-42-generic
  • Flutter: 3.50
  • GPU: Intel Tiger Lake (PCI ID 8086:9a78)
  • GPU driver: i915
  • Compositor: Sway
  • Sway renderer: WLR_RENDERER=gles2
  • Wayland socket: wayland-1
  • GTK-based Flutter Linux application

What I've confirmed:

  1. The application process runs normally.
  2. Sway recognizes the window as a native Wayland xdg_shell surface.
  3. The application is not running through XWayland.
  4. The Intel GPU driver initializes successfully.
  5. The application loads its assets and initializes its services.
  6. There are no obvious fatal GPU errors in dmesg.
  7. WLR_SCENE_DISABLE_DIRECT_SCANOUT=1 is already enabled.

Sway reports:

floating_con "gameselector_main"
(xdg_shell, app_id: "gameselector_main")

Environment variables:

WAYLAND_DISPLAY=wayland-1
DISPLAY=:0
XDG_RUNTIME_DIR=/run/user/1000
WLR_RENDERER=gles2

What I'm investigating:

I suspect this might be related to the Linux rendering changes introduced in Flutter 3.50, possibly involving FlViewRendererSubsurface, EGL/OpenGL, or Wayland buffer presentation.

I'm currently adding additional native GTK and Flutter frame diagnostics, along with a minimal rendering test to isolate the issue.

I'm also considering testing Flutter 3.51.0-0.1.pre (beta) to see whether the issue has been fixed.

My questions:

  • Has anyone experienced black screens with Flutter 3.50 on Sway or other wlroots-based Wayland compositors?
  • Are there known regressions involving FlViewRendererSubsurface or EGL rendering?
  • Is there a supported way to switch between the old and new Flutter Linux rendering paths for debugging?
  • Has anyone tested Flutter 3.51 beta with similar issues?

I'd prefer to keep native Wayland support rather than switching to XWayland.

Any suggestions for debugging this would be greatly appreciated. Thanks!

10 Upvotes

2 comments sorted by

1

u/karmatics29 8d ago

I haven't hit this exact combination, but since the app logic is clearly fine and only presentation is broken, I'd try to narrow down which layer drops the frames:

  1. Run with WAYLAND_DEBUG=1 and look at the surfaces Flutter creates. If the main surface and the subsurface get wl_surface.commit calls but the subsurface never gets a wl_surface.attach with a buffer (or only gets one once), the problem is on the Flutter/EGL presentation side, not Sway.
  2. Swap the compositor renderer before touching Flutter: try WLR_RENDERER=vulkan (or pixman just as a test). If the window suddenly renders, it's a gles2-in-wlroots plus subsurface interaction, which is worth a wlroots/Sway issue as well.
  3. Try GDK_GL=gles and set GDK_BACKEND=wayland explicitly. You have DISPLAY=:0 set too, and forcing the backend and GL API removes two variables at once.
  4. Run a fresh flutter create counter app built with 3.50 on the CoreBox. If that's also black, it's a framework/embedder regression and you can bisect quickly by building the same sample with the previous stable on the same device.
  5. If you can run Weston or cage on that box, test there too. Working on another compositor plus failing on Sway gives the Flutter team a much more actionable bug report.

If the minimal app reproduces it, I'd file it on flutter/flutter with the WAYLAND_DEBUG excerpt and your Sway version. That excerpt makes triage much faster.

1

u/Ok_Consideration_924 7d ago

I had the same issue with some flutter apps, apparently the last Mesa update has broken some things (I'm on Arch so maybe not the same) the last version that i could get to work was `mesa-1:26.2.7`