Enable debug mode if FLET_PAGE_URL provided

This commit is contained in:
Feodor Fitsner 2025-06-10 13:11:03 -07:00
parent 7174430e6f
commit 9e3d215ca8
1 changed files with 7 additions and 6 deletions

View File

@ -64,6 +64,11 @@ Map<String, String> environmentVariables = {};
void main(List<String> args) async {
_args = List<String>.from(args);
var devPageUrl = const String.fromEnvironment("FLET_PAGE_URL");
if (devPageUrl != "") {
_args.addAll([devPageUrl, "--debug"]);
}
for (var ext in extensions) {
ext.ensureInitialized();
}
@ -124,7 +129,6 @@ Future prepareApp() async {
await setupDesktop();
var devPageUrl = const String.fromEnvironment("FLET_PAGE_URL");
if (kIsWeb) {
// web mode - connect via HTTP
pageUrl = Uri.base.toString();
@ -132,13 +136,10 @@ Future prepareApp() async {
if (routeUrlStrategy == "path") {
setPathUrlStrategy();
}
} else if ((_args.isNotEmpty || devPageUrl != "") && isDesktopPlatform()) {
} else if (_args.isNotEmpty && isDesktopPlatform()) {
// developer mode
debugPrint("Flet app is running in Developer mode");
pageUrl = devPageUrl;
if (_args.isNotEmpty && pageUrl == "") {
pageUrl = _args[0];
}
if (_args.length > 1) {
var pidFilePath = _args[1];
debugPrint("Args contain a path to PID file: $pidFilePath}");