31.59 Flutter Run

20210328

The run command will build and run the application for the default device, which is the first one listed by the devices command.

flutter run

To choose a different device use -d or --device-id=

flutter run --device-id=linux

The device ID is listed as the second column in the devices command.

On initiating a run the following is displayed (in addition to debug and trace information):

Flutter run key commands.
r Hot reload.
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

Whilst running it is possible to do a “hot” reload of the app - that is, whilst the app is running on the device, changes can be made to the app code (in lib/main.dart) and in the console where the run was initiated, type r and Return to hot reload the app.

In fact there are more commands available in run mode, listed with the h command. Some of them are:

Flutter run key commands.
[...]
s Save a screenshot to flutter.png.
b Toggle the platform brightness setting (dark and light mode).
w Dump widget hierarchy to the console.
t Dump rendering tree to the console.
L Dump layer tree to the console.
S Dump accessibility tree in traversal order.
U Dump accessibility tree in inverse hit test order.
i Toggle widget inspector.
I Toggle oversized image inversion.
p Toggle the display of construction lines.
o Simulate different operating systems.
z Toggle elevation checker.
g Run source code generators.
M Write SkSL shaders to a unique file in the project directory.
v Launch DevTools.
P Toggle performance overlay.
a Toggle timeline events for all widget build methods.


Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0