Skip to content

paulocoutinhox/flutter-gadget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flutter Gadget β€” Hardware Buttons for Your Flutter Workflow πŸš€

Tired of typing flutter clean, flutter pub get, or flutter upgrade every time? With this little ESP32/Arduino gadget, you can map physical buttons to your Flutter commands. Press a button on the device β†’ the command runs instantly on your computer. ⚑

Flutter Gadget


✨ Features

  • πŸ–±οΈ Physical buttons trigger Flutter commands
  • πŸ–₯️ Cross-platform Python daemon (macOS, Linux, Windows)
  • πŸ”Œ Auto-detects serial port
  • βœ… Token validation (only recognized commands are executed)
  • πŸ”§ Built with Arduino IDE / ESP32 firmware + Python script

πŸ–ΌοΈ Circuit

Circuit diagram


πŸ“‚ Project Structure

firmware/
  esp32_flutter_keys/
    esp32_flutter_keys.ino # ESP32/Arduino firmware
daemon/
  main.py                  # Python cross-platform daemon
  requirements.txt         # Python dependencies

βš™οΈ How It Works

1. ESP32 / Arduino Firmware

  • Written in C++ (Arduino IDE)
  • Uses INPUT_PULLUP buttons on GPIOs
  • On press, sends a short token via Serial:
    • CLEAN β†’ flutter clean
    • PUBGET β†’ flutter pub get
    • UPGRADE β†’ flutter upgrade

πŸ‘‰ Flash the firmware using Arduino IDE (choose ESP32 board or Arduino board). πŸ‘‰ On the ESP32 C6, recommended pins are 20 / 21 / 22 (safe GPIOs).

πŸ‘‰ Online project on Wokwi: https://wokwi.com/projects/440295324580074497


2. Python Daemon

  • Listens on the serial port
  • Validates incoming tokens
  • Executes the matching Flutter command in your project directory

Requirements:

# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r daemon/requirements.txt

Run:

# Activate virtual environment
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Set your Flutter project path
export FLUTTER_KEYS_PROJECT="~/dev/my_flutter_app"   # your project path

# Run the daemon
python3 daemon/main.py

Cross-platform details:

  • macOS/Linux β†’ runs inside zsh/bash, inherits your PATH correctly
  • Windows β†’ runs in PowerShell, uses your PATH or FVM shims

πŸ”— References


πŸš€ Getting Started

  1. Clone this repo
  2. Flash the ESP32/Arduino firmware
  3. Install the Python requirements
  4. Run the daemon and press the buttons πŸŽ‰

πŸ“œ License

This project is licensed under the MIT License. Feel free to fork, modify, and share.

About

Flutter Gadget β€” Hardware Buttons for Your Flutter Workflow πŸš€

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published