If you run this example just like flutter run or create Snap package, it will work fine. If you create the following Flatpak configuration, the built package will produce an error and notification is not displayed:
/* Make sure the client is not playing games with the serials, as that
could confuse us. */
if (header->serial <= client->last_serial)
{
g_warning ("Invalid client serial");
side_closed (side);
buffer_unref (buffer);
return;
}
The only solution at the moment is to use the --socket=session-bus option during Flatpak build, or to call DBusClient.session() after Flutter is fully initialized or at the moment of using DBus.
This happens with Flatpak and a Flutter application if I call
DBusClient.session()
before calling therunApp()
method.Example (just show notification by button clicking) https://github.com/proninyaroslav/dbus_broken_pipe:
If you run this example just like
flutter run
or create Snap package, it will work fine. If you create the following Flatpak configuration, the built package will produce an error and notification is not displayed:https://github.com/proninyaroslav/dbus_broken_pipe/tree/master/flatpak
journalctl log (tested on Fedora 34):
Session bus is used:
The
xdg-dbus-proxy[13808]: Invalid client serial
error refers to the follow section ofxdg-dbus-proxy
, used by Flatpak to proxy and filtering DBus calls (for example,--talk-name=org.freedesktop.Notifications
build option): https://github.com/flatpak/xdg-dbus-proxy/blob/master/flatpak-proxy.c#L2160The only solution at the moment is to use the
--socket=session-bus
option during Flatpak build, or to callDBusClient.session()
after Flutter is fully initialized or at the moment of using DBus.