Skip to content

Flutter + hardware starter kit.

Talk to Arduino and ESP32 boards from Flutter over USB OTG, WiFi TCP sockets, or Bluetooth LE, without hitting the six traps that burn a whole weekend.

Open-source fork (Android 12–14)

usb_serial_for_android

Fixes AGP 8/9 namespace builds, Android 12 and 14 PendingIntent and receiver export flags, leaked probe connections, and a generic serial terminal example with line framing tests.

Open on GitHub

MIT example repo (WiFi + BLE)

flutter_wireless_serial

One small BoardLink interface with WifiLink (dart:io TCP socket) and BleLink (Nordic UART Service via universal_ble), plus ESP32 sketches and socket tests against a fake board.

Open on GitHub

Verification note: both repos pass flutter analyze, unit tests, and fresh APK builds; as noted in their READMEs, the updated Android 14 permission path and wireless sketches have not been re-verified on physical boards yet. Open an issue or email me if you test on hardware.

Android device_filter.xml Vendor IDs

Android’s device_filter.xml requires decimal vendor IDs, not hex. Put the decimal column in vendor-id="...".

Board / USB bridgeHexDecimal (for XML)
Espressif native USB (ESP32-S2/S3/C3)0x303A12346
WCH CH340 / CH3410x1A866790
Silicon Labs CP210x0x10C44292
FTDI FT232R / FT22320x04031027
Prolific PL23030x067B1659
Arduino LLC0x23419025
Raspberry Pi RP20400x2E8A11914

5-minute ESP32 troubleshooting table

  • ESP32 sends nothing back over USB (no error)

    Native USB boards running TinyUSB discard output until the host asserts DTR. Call setDTR(true), wait ~1 second, and always call listen() before connect() so the native read loop actually starts.

  • Build fails with "Namespace not specified" on AGP 8+

    Most pub.dev USB serial plugins stopped updating in 2022. Use a fork that declares namespace in build.gradle and targets compileSdk 35+.

  • USB permission dialog crashes on Android 12 or 14

    PendingIntent needs FLAG_MUTABLE on API 31+, setPackage(packageName) to stay explicit on Android 14, and RECEIVER_NOT_EXPORTED on API 33+.

  • JSON replies fail jsonDecode halfway through

    USB, TCP sockets and BLE all deliver arbitrary byte chunks. Never parse a chunk: buffer until newline (\n or \r\n) and ignore firmware debug lines.

  • BLE messages stop at exactly 20 characters

    BLE notification payload is MTU minus 3 bytes (23 - 3 = 20 by default). Request a larger MTU after connecting, or frame lines across packets.

  • WiFi TCP socket works in debug, fails in release APK

    Flutter only puts android.permission.INTERNET in the debug manifest. Add it explicitly to android/app/src/main/AndroidManifest.xml.

Watch the step-by-step walkthrough

Prefer a video? Here is the 9-minute Android USB serial tutorial covering the manifest, device_filter.xml, line framing, and the DTR trap.

One email each Sunday.

The new video and the real numbers behind it.

Or talk to me.

App, cloud, or both. Twenty minutes.