@@ -22,7 +22,7 @@ local current_device = nil
22
22
23
23
--- @class flutter.Runner
24
24
--- @field is_running fun ( runner : flutter.Runner ): boolean
25
- --- @field run fun ( runner : flutter.Runner , paths : table , args : table , cwd : string , on_run_data : fun ( is_err : boolean , data : string ), on_run_exit : fun ( data : string[] , args : table ), is_flutter_project : boolean , project_conf : flutter.ProjectConfig ?)
25
+ --- @field run fun ( runner : flutter.Runner , paths : table , args : table , cwd : string , on_run_data : fun ( is_err : boolean , data : string ), on_run_exit : fun ( data : string[] , args : table , project_conf : flutter.ProjectConfig ? ), is_flutter_project : boolean , project_conf : flutter.ProjectConfig ?)
26
26
--- @field cleanup fun ( funner : flutter.Runner )
27
27
--- @field send fun ( runner : flutter.Runner , cmd : string , quiet : boolean ?)
28
28
81
81
82
82
--- Handle a finished flutter run command
83
83
--- @param result string[]
84
- local function on_run_exit (result , cli_args )
84
+ --- @param cli_args string[]
85
+ --- @param project_config flutter.ProjectConfig ?
86
+ local function on_run_exit (result , cli_args , project_config )
85
87
local matched_error , msg = has_recoverable_error (result )
86
88
if matched_error then
87
89
local lines = devices .to_selection_entries (result )
88
90
ui .select ({
89
91
title = (" Flutter run (%s)" ):format (msg ),
90
92
lines = lines ,
91
- on_select = function (device ) devices .select_device (device , cli_args ) end ,
93
+ on_select = function (device ) devices .select_device (device , cli_args , project_config ) end ,
92
94
})
93
95
end
94
96
shutdown ()
276
278
277
279
--- Run the flutter application
278
280
--- @param opts RunOpts
279
- function M .run (opts )
281
+ --- @param project_conf flutter.ProjectConfig ?
282
+ function M .run (opts , project_conf )
280
283
if M .is_running () then return ui .notify (" Flutter is already running!" ) end
281
- select_project_config (function (project_conf ) run (opts , project_conf ) end )
284
+ if project_conf then
285
+ run (opts , project_conf )
286
+ else
287
+ select_project_config (function (selected_project_conf ) run (opts , selected_project_conf ) end )
288
+ end
282
289
end
283
290
284
291
--- @param cmd string
0 commit comments