Sub topic 1
What Flutter and Dart Are
Prerequisites
This chapter assumes you know basic programming concepts such as variables, functions, and classes. You should be comfortable running commands in a terminal. Familiarity with an object-oriented language such as Dart, Java, Kotlin, Swift, or C# helps, but it is not required.
What Flutter and Dart Are
Flutter is a UI toolkit from Google for building apps for mobile, web, and desktop from one codebase. Dart is the programming language you write Flutter apps in. Dart is object-oriented and statically typed, which means the compiler checks types before the app runs. The Flutter SDK bundles the Dart SDK, so you do not install Dart separately.
Installing the Flutter SDK
The Flutter SDK (software development kit) is the package of command-line tools, libraries, and the compilers that build your app. Download the archive for your operating system from flutter.dev and extract it to a stable folder, such as your home directory. Then add the SDK's bin directory to your PATH, the list of folders your shell searches for commands.
flutter --version> Note: the callout below is the only callout in this chapter.
Checking Your Setup with flutter doctor
The flutter doctor command inspects your installation. It checks the SDK, the Android toolchain, editor plugins, and connected devices.
flutter doctorEach line ends with a check mark or a warning. Follow the hint printed under each warning before you continue.
Setting Up Your Editor
You can use VS Code with the Flutter extension or Android Studio with the Flutter plugin. The Flutter extension also installs the Dart extension. Together they provide code completion, live error checking, and a run button.
Choosing Where to Run Your App
A run target is the device or platform that displays your app. Common targets include Android emulators, iOS simulators (macOS only), Chrome, and Windows, macOS, or Linux desktop. Physical phones also work after you enable developer mode. List the targets Flutter sees:
flutter devicesThen start the app on one of them by passing its id, for example flutter run -d chrome.
Exercise
Exercise
Which command lists the devices and targets Flutter can run on?
Show answer
flutter devices