31.8 Flutter App Creation

20230825

To begin a new app simply make up a name for the app and ask flutter to create a folder of the same name. The folder will contain an initial skeleton version of an app, ready to build and run. Here we create an app called button:

flutter create button
cd button

The skeleton and fully functional dart program is found in lib/main.dart. The file pubspec.yaml holds general information about the app (name, description, publish_to, and version), the development environment, dependencies (including dev_dependencies required just for development), and Flutter configurations. The actual versions of packages used is recorded in pubspec.lock. The locked version can be useful to ensure we have a stable and known working version of the package, in case package updates lead to failure amongst the packages, rather than our application.

Flutter apps can run on any one of multiple platforms. To check what you can target on your computer run the devices command:

flutter devices

If you are on a Windows desktop then you will see the windows device listed and you can build and run the app:

flutter run -d windows

If your Android device is connected to the computer then you can build, install, and run the app on the device with run:

flutter run

For a Linux desktop:

flutter run -d linux

See Section 31.38 for further details on building and running on a Linux desktop. See Section ?? to learn how to distribute your app.



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