Skip to content

[flutter_tools] Enable hot reload on the web #169174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix manual arg parsing
  • Loading branch information
nshahan committed May 20, 2025
commit adb714f96bf8e48465df7b47ca22b017a1bd3d19
32 changes: 28 additions & 4 deletions packages/flutter_tools/lib/src/build_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'base/os.dart';
import 'base/utils.dart';
import 'convert.dart';
import 'globals.dart' as globals;
import 'runner/flutter_command.dart' show FlutterOptions;

/// Whether icon font subsetting is enabled by default.
const bool kIconTreeShakerEnabledDefault = true;
Expand Down Expand Up @@ -263,13 +264,36 @@ class BuildInfo {
/// The module system DDC is targeting, or null if not using DDC or the
/// associated flag isn't present.
// TODO(markzipan): delete this when DDC's AMD module system is deprecated, https://github.com/flutter/flutter/issues/142060.
DdcModuleFormat? get ddcModuleFormat =>
_ddcModuleFormatAndCanaryFeaturesFromFrontEndArgs(extraFrontEndOptions).ddcModuleFormat;
DdcModuleFormat get ddcModuleFormat {
final DdcModuleFormat moduleFormat =
webEnableHotReload ? DdcModuleFormat.ddc : DdcModuleFormat.amd;
final DdcModuleFormat? parsedFormat =
_ddcModuleFormatAndCanaryFeaturesFromFrontEndArgs(extraFrontEndOptions).ddcModuleFormat;
if (parsedFormat != null && moduleFormat != parsedFormat) {
throw Exception(
'Unsupported option combination:\n'
'${FlutterOptions.kWebExperimentalHotReload}: $webEnableHotReload\n'
'${FlutterOptions.kExtraFrontEndOptions}: --dartdevc-module-format=${parsedFormat.name}',
);
}
return moduleFormat;
}

/// Whether to enable canary features when using DDC, or null if not using
/// DDC or the associated flag isn't present.
bool? get canaryFeatures =>
_ddcModuleFormatAndCanaryFeaturesFromFrontEndArgs(extraFrontEndOptions).canaryFeatures;
bool get canaryFeatures {
final bool canaryEnabled = webEnableHotReload;
final bool? parsedCanary =
_ddcModuleFormatAndCanaryFeaturesFromFrontEndArgs(extraFrontEndOptions).canaryFeatures;
if (parsedCanary != null && canaryEnabled != parsedCanary) {
throw Exception(
'Unsupported option combination:\n'
'${FlutterOptions.kWebExperimentalHotReload}: $webEnableHotReload\n'
'${FlutterOptions.kExtraFrontEndOptions}: --dartdevc-canary=$parsedCanary',
);
}
return canaryEnabled;
}

/// Convert to a structured string encoded structure appropriate for usage
/// in build system [Environment.defines].
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy