From 7174430e6f936b9c71c6d49de18bc02eeb42b3e9 Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Tue, 10 Jun 2025 11:36:42 -0700 Subject: [PATCH] Support developer mode with custom URL --- {{cookiecutter.out_dir}}/lib/main.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.out_dir}}/lib/main.dart b/{{cookiecutter.out_dir}}/lib/main.dart index be3f906..8bd50dd 100644 --- a/{{cookiecutter.out_dir}}/lib/main.dart +++ b/{{cookiecutter.out_dir}}/lib/main.dart @@ -124,6 +124,7 @@ Future prepareApp() async { await setupDesktop(); + var devPageUrl = const String.fromEnvironment("FLET_PAGE_URL"); if (kIsWeb) { // web mode - connect via HTTP pageUrl = Uri.base.toString(); @@ -131,10 +132,13 @@ Future prepareApp() async { if (routeUrlStrategy == "path") { setPathUrlStrategy(); } - } else if (_args.isNotEmpty && isDesktopPlatform()) { + } else if ((_args.isNotEmpty || devPageUrl != "") && isDesktopPlatform()) { // developer mode debugPrint("Flet app is running in Developer mode"); - pageUrl = _args[0]; + 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}");