2. Setting Up the Work Environment
2.1. Installing the Tools
-
Node.js: Download and install version 22 (or later) from nodejs.org. Verify the installation in a terminal:
-
Visual Studio Code (VSCode): available for free download at code.visualstudio.com. Install the [Flutter] extension (which also installs the [Dart] extension).
-
[MySQL] 8: Install, for example, via XAMPP, Laragon (on Windows), or directly via [MySQL] Community Server. A graphical administration tool (phpMyAdmin, [MySQL] Workbench, DBeaver, HeidiSQL…) simplifies the process. Subsequently, the Laragon tool is used.
2.2. Installing the Flutter client
Launch VSCode without specifying a project:

- In [1-2], open the command palette;

- In [3], create a new Flutter project;

- in [4], create an app;

- In [5-6], specify a folder where the project subfolder will be created;

- in [6], name the project. This will also be the name of the folder created for the project;

- In [1-3], specify the project targets in [1 – Android application, 2 – desktop application, 3 – web application];

- to [4], the created project. VSCode automatically downloads the Flutter SDK;
The [flutter doctor] command verifies that everything [Flutter] needs is in place, target by target. Run it in a VSCode terminal of the newly created Flutter project:
When everything is correct, you’ll get a result like this (version numbers may vary):
Each line begins with a symbol: [√] (everything is fine), [!] (warning: an element is missing, which doesn’t necessarily prevent the code from working), or [X] (error). For this course, the relevant lines are [Flutter], [Android toolchain] (compilation for a phone), [Android], and [Connected device] (at least one device detected, specifically the phone). The lines [Chrome] (web target) and [Visual Studio] (Windows target) apply only to those targets: A [!] or [X] on a target you are not using can be ignored.
If [Android toolchain] reports “cmdline-tools component is missing,” install [Android SDK Command-line Tools] (see below); if it reports “Android license status unknown,” accept the licenses (step 5). The [flutter doctor -v] command provides details on each check.
Now list the applications (devices) recognized by Flutter:
In column 2, you’ll find the IDs of the recognized devices. To launch the Flutter app on one of them:
For example, to launch the [flutter_application_1] app in the Edge browser:
The following result appears in the Edge browser:

We will now describe how to install the tools for Android development.
2.3. Android Studio and Android command-line tools
The target device for this course is a [Android] phone. To compile the application and install it on this phone, [Flutter] requires the [Android] SDK, which are installed along with [Android Studio], Google's development environment. [Android Studio] is not used for writing code—the editor remains [VSCode]—it is used here solely to install and update the [Android] SDK.
- [Android Studio]: Download it for free from [https://developer.android.com/studio] and then install it. When you launch it for the first time, the wizard will offer a standard installation: accept it, and it will download the [Android] SDK.

- Open [SDK Manager] from [Android Studio] (the [Tools / SDK Manager] menu when a project is open, or [More Actions / SDK Manager] from the home screen): This is the file that installs and updates the components of the [Android] SDK.
- [SDK Platforms] tab: Verify that a recent [Android] platform is installed (the [Flutter] documentation specifies version 36 at the time of writing).

- [SDK Tools] tab: Check [Android SDK Command-line Tools (latest)], [Android SDK Build-Tools], and [Android SDK Platform-Tools] (as well as [Android Emulator] if you want to test on an emulator), then click [Apply]. The documentation for [Flutter] also recommends [CMake] and [NDK (Side by side)]. It is the [Android SDK Command-line Tools] packages that are missing when [flutter doctor] displays “cmdline-tools component is missing.”
- Accept the licenses for the [Android] SDK by entering the following command in a terminal within the Flutter project, then answering “[y]” to each question until you see the message “All SDK package licenses accepted.”:
[Note]: With version 23.0 of [Android SDK Command-line Tools], the command above may complete immediately, without prompting for anything, displaying “The --licenses option is no longer needed.” This is a known issue in [Flutter] (issues 191558 and 191487 on github.com/flutter/flutter). Workaround: In [SDK Manager], [SDK Tools] tab, check [Show Package Details], replace version 23.0 of [Android SDK Command-line Tools] with version 22.0, click on [Apply], and then rerun the command.
2.4. Set up an Android emulator
If you don’t have a phone, you can test the app on a [Android] emulator: a virtual phone that runs in a window on your computer. [Android Studio] installs the [Android Emulator] program (if it was checked in the [SDK Manager], see above) but does not provide a ready-to-use virtual device: you must create one.
- [Prerequisite]: Virtualization must be enabled in the computer’s [BIOS], and under [Windows], the [Windows Hypervisor Platform] feature must be checked ([Control Panel / Programs / Turn Windows features on or off]), which requires a restart. Otherwise, the emulator will not start or will remain very slow.
- Open [Device Manager] from [Android Studio]: [More Actions / Virtual Device Manager] from the home screen, or [Tools / Device Manager] when a project is open (depending on the version: [View / Tool Windows / Device Manager]).

- Click on [Create Device], select a template (for example, [Pixel 8]), then [Next]. Select a recent [Android] system image for the [x86_64] processor and download it using the [Download] link located next to it, then [Next] and [Finish].



- Start the emulator using the [Play] button on the [Device Manager]:

- Wait until the [Android] home screen appears in the emulator window: the first startup may take several minutes. Then verify that [Flutter] recognizes the emulator, which should appear in the list (for example, [emulator-5554], platform [android-x64]):
[Note]: if [flutter devices] does not display the emulator but instead shows the message “Device emulator-5554 is offline,” the emulator has not finished starting up, or [adb] (the tool that connects the computer to the device, installed along with [Android SDK Platform-Tools]) is in an inconsistent state. Try the following in order: (1) wait for the welcome screen to appear, then rerun the command; (2) restart [adb] using the following three commands (in [Windows], within [PowerShell]), with the last one displaying “device” rather than “offline”; (3) In the device’s [Device Manager] menu ([⋮]), select [Cold Boot Now], or even [Wipe Data] as a last resort.
If the problem persists, use [where.exe adb] to verify that no other [adb], of a different version, is present in the [PATH]: Two versions of [adb] competing for the connection cause this issue.
Once the emulator is recognized, the application launches on it with the following command (see the “Installation and Execution” section):

Preparing the Android phone
To run the application on a real [Android] phone, the phone must be set to allow control from the computer:
- Enable developer options: open [Settings / About phone], then tap [Build number] several times (usually 7) until the phone indicates that you are a developer. The exact labels vary by manufacturer.
- Enable [USB debugging] in the [Developer options] menu (added in the previous step).
- Connect the phone to the computer using a USB cable that transfers data (not just charges the phone), and accept the USB debugging authorization request on the phone. On Windows, if the phone is not recognized, install the manufacturer’s driver USB (“OEM USB drivers,” see [https://developer.android.com/studio/run/oem-usb]).
- Verify that [Flutter] can detect the phone: it should appear in the list displayed by the following command, along with the [android] platform:
The phone will access the [NestJS] server via the computer’s IP address on the local network (not via [localhost]): this configuration is described in Chapter 5.