Skip to content

Comments

feat: Add --base-href support to flutter run for web#182709

Open
Mastersam07 wants to merge 3 commits intoflutter:masterfrom
Mastersam07:add-base-href-to-run-command
Open

feat: Add --base-href support to flutter run for web#182709
Mastersam07 wants to merge 3 commits intoflutter:masterfrom
Mastersam07:add-base-href-to-run-command

Conversation

@Mastersam07
Copy link
Contributor

@Mastersam07 Mastersam07 commented Feb 21, 2026

Description

Adds --base-href support to the flutter run command for web targets.

Previously, --base-href was only available on flutter build web, which meant developers testing web apps hosted in subfolders had to manually edit web/index.html during development and undo the change before committing. This PR brings the same flag to flutter run, so the dev server correctly serves the app with a custom base path.

Usage

flutter run -d chrome --base-href=/preview/

The value must start and end with /, matching the same validation as flutter build web --base-href.

Fixes #163141

Pre-launch Checklist

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 21, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the --base-href flag to the flutter run command for web targets, which is a valuable addition for developers testing applications in subfolders. The implementation correctly handles template substitution and server routing. I've noted a few improvements: ensuring the value is also read from the configuration file, adding the missing parsing logic in WebDevServerConfig.fromYaml, and using existing utility functions for cleaner string manipulation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Support --base-href for flutter run

1 participant