
- Published on
- ·2 min read
Flutter × WiFi: Talking to IoT Devices Over the Local Network
- Authors

- Name
- Bert / DOTUNE
- Developer
The BLE article covered Bluetooth — the communication layer, the bridging options, Platform Channels, FFI. The whole piece was about "how Flutter talks to hardware over BLE." The bar is high, but once you clear it, many IoT devices take the next step: BLE pairs the device, then it switches to WiFi.
That's what this article is about: once BLE gets the device onto the local network, how does Flutter talk to it?
The answer is refreshingly simple: pure Dart. http, mqtt_client, web_socket_channel — import and go. No Platform Channels. No FFI. The device is already on the same network. Flutter talks to it IP-to-IP.
BLE vs WiFi — Quick Recap
These two aren't competitors in IoT. They're complementary layers:
| BLE | WiFi | |
|---|---|---|
| Range | ~10m | Entire local network |
| Bandwidth | Low | High |
| Power | Ultra-low | Moderate |
| Role | Pairing, configuration, low-frequency telemetry | Streaming data, firmware updates, real-time control |
The pattern is near-universal on smart bulbs, smart plugs, printers, and robot vacuums. BLE handles the initial handshake. WiFi takes over for everything else. On the Flutter side — BLE through the BLE article, WiFi through this one. Each does its job.
Three Protocols, All in Pure Dart
Once the device is on WiFi, you have three straightforward options. No native code required.
HTTP — the simplest. Most IoT devices expose a REST API or a basic HTTP endpoint for status and control. http package, GET/POST, done. Great for occasional commands: turn on, set temperature, check firmware version. Not ideal for real-time streaming.
MQTT — the IoT standard. Publish/subscribe model. The device publishes sensor readings to a topic. Flutter subscribes to that topic. Low bandwidth, persistent connection, works beautifully for telemetry. mqtt_client package handles the protocol. You'll need an MQTT broker (Mosquitto on a Raspberry Pi, or a cloud service).
WebSockets — for when you need bidirectional, low-latency communication. The device pushes data, Flutter pushes commands, both in real time. web_socket_channel package. Heavier than MQTT but simpler to reason about for interactive control.
The rule of thumb: HTTP for commands, MQTT for telemetry, WebSockets for real-time interaction. Pick the one that matches your data flow, and it's pure Dart from there.