@@ -25,14 +25,23 @@ enum FlutterWebRenderer {
25
25
26
26
/// Build options.
27
27
class FlutterWebAppBuildOptions {
28
+ /// Target
29
+ ///
30
+ /// The main entry-point file of the application, as run on the device.
31
+ /// If the "--target" option is omitted, but a file name is provided on the command line, then that is used
32
+ /// instead.
33
+ ///
34
+ /// (defaults to "lib/main.dart")
35
+ final String ? target;
36
+
28
37
/// Renderer
29
- FlutterWebRenderer ? renderer;
38
+ final FlutterWebRenderer ? renderer;
30
39
31
40
/// Compile as wasm
32
- bool ? wasm;
41
+ final bool ? wasm;
33
42
34
43
/// Build options.
35
- FlutterWebAppBuildOptions ({this .renderer, this .wasm});
44
+ FlutterWebAppBuildOptions ({this .renderer, this .wasm, this .target });
36
45
}
37
46
38
47
/// Web app options
@@ -111,16 +120,23 @@ class FlutterWebAppBuilder implements CommonAppBuilder {
111
120
deployer: deployer);
112
121
}
113
122
114
- Shell get _shell => controller? .shell ?? Shell ();
123
+ Shell get _shell => controller? .shell ?? Shell (workingDirectory : path );
115
124
116
125
/// Build
117
126
Future <void > build () async {
127
+ await buildOnly ();
128
+ await _webAppBuildToDeploy ();
129
+ }
130
+
131
+ /// Build
132
+ Future <void > buildOnly () async {
133
+ var buildOptions = options.buildOptions;
118
134
var shell = _shell;
119
135
var renderOptions = '' ;
120
- var wasm = options. buildOptions? .wasm ?? false ;
136
+ var wasm = buildOptions? .wasm ?? false ;
121
137
if (! wasm) {
122
138
// not compatible with wasm
123
- switch (options. buildOptions? .renderer) {
139
+ switch (buildOptions? .renderer) {
124
140
case FlutterWebRenderer .html:
125
141
renderOptions = ' --web-renderer html' ;
126
142
break ;
@@ -131,8 +147,12 @@ class FlutterWebAppBuilder implements CommonAppBuilder {
131
147
}
132
148
}
133
149
var wasmOptions = wasm ? ' --wasm' : '' ;
134
- await shell.run ('flutter build web$renderOptions $wasmOptions ' );
135
- await _webAppBuildToDeploy ();
150
+ var targetOptions = '' ;
151
+ if (buildOptions? .target != null ) {
152
+ targetOptions = ' --target ${buildOptions !.target }' ;
153
+ }
154
+ await shell
155
+ .run ('flutter build web$renderOptions $wasmOptions $targetOptions ' );
136
156
}
137
157
138
158
/// Copy to deploy using deploy.yaml
0 commit comments