Flutter dev environment with docker and vscode
{{Flutter}} for local development
This is a list of steps to get running flutter inside docker with vscode dev container support. The idea is not to install all the dependencies needed to run Android emulator and Android Studio locally. With this, when you open the project in VSCODE it’s start a new dev container (docker) with the project running.
How to get emulator running
- download docker image flutter-docker🡭 with android emulator and all dependencies
- run the following command to get the image running:
xhost local:$USER && docker run --rm -ti -e UID=$(id -u) -e GID=$(id -g) -p 42000:42000 --workdir /project --device /dev/kvm --device /dev/dri:/dev/dri -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY -v "$PWD":/project --entrypoint flutter-android-emulator matspfeiffer/flutter
- open dev container in vscode
- inside vscode deb container, run:
flutter emulators --launch flutter_emulator
. This will open the emulator with a full android device working. - run build runner:
flutter packages pub run build_runner build
How to install VSCODE dev container
Build
flutter clean
clear all assets and file, that were generated in dev and debug session.flutter build apk
to create a .APK insidebuild/app/outputs/flutter-apk/app-release.apk
Faq’s y tips
- en
pubspec.yml
se definen las dependencias y los assets. Seria como un pseudopackage.json
flutter pub get
para instalar nuevas dependencias- en vscode con el plugin de flutter y trabajando adentro de un container, funciona todo muy mágicamente.
TODO
- command and build process to generate a production and app store ready application