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
I have searched the opened issues and there are no duplicates
Describe the bug
The current implementation of Flet build template explicitly sets the ENV VARS of the app, which may not work well if the app is to be used in a container / sandboxed environment (flatpak on linux for example).
Code sample
generated build/flutter/lib/main.dart line 192-201:
if (defaultTargetPlatform == TargetPlatform.windows) {
// use TCP on Windows
var tcpPort = await getUnusedPort();
pageUrl = "tcp://localhost:$tcpPort";
environmentVariables["FLET_SERVER_PORT"] = tcpPort.toString();
} else {
// use UDS on other platforms
pageUrl = "flet_$pid.sock";
environmentVariables["FLET_SERVER_UDS_PATH"] = pageUrl;
}
line 221-241:
ServerSocket outSocketServer;
String socketAddr = "";
StringBuffer pythonOut = StringBuffer();
if (defaultTargetPlatform == TargetPlatform.windows) {
var tcpAddr = "127.0.0.1";
outSocketServer = await ServerSocket.bind(tcpAddr, 0);
debugPrint(
'Python output TCP Server is listening on port ${outSocketServer.port}');
socketAddr = "$tcpAddr:${outSocketServer.port}";
} else {
socketAddr = "stdout_$pid.sock";
if (await File(socketAddr).exists()) {
await File(socketAddr).delete();
}
outSocketServer = await ServerSocket.bind(
InternetAddress(socketAddr, type: InternetAddressType.unix), 0);
debugPrint('Python output Socket Server is listening on $socketAddr');
}
environmentVariables["FLET_PYTHON_CALLBACK_SOCKET_ADDR"] = socketAddr;
To reproduce
flet build linux
Expected behavior
The app should prioritize already set system ENV VARs, only if undefined proceed to override them with defaults.
Activity
fix: respect pre-set environment variables in build template (#6394)