Bluetooth Got you Down? Look Here!

Success Stories

I think most of you guys are still struggling with the BLE on the FlutterFlow so that's why you click on this blog.

The following blog seems like the "best" tutorial for the BLE on FlutterFlow. However, it was published 2 years ago and the dependencies are out of date. Till 2025, if you spend your time reproducing this blog step by step, it will be a totally waste of time.

https://blog.flutterflow.io/creating-an-app-for-interacting-with-any-iot-devices-using-ble/

However, the UI design and the logic chain in this blog is nice even though it's not working for people in the 2025. In this project https://app.flutterflow.io/project/ble2024-d530xd , @Nathanael Schwab did a really good job to update the necessary dependencies and the corresponding code to make it work again! Till now (03/06/2025), this project can be cloned and used directly.

Some tips for debugging:

  1. The main reasons that the old method in the blog not working are from the "dependencies" and "permissions". I hope the FlutterFlow will give some more supports for the Bluetooth App soon, but for now we need to explore how to use it by ourselves. And that's why I want to share with you guys about what I found.

  2. If you are trying to send the UINT to your customized MCU program and felt frustrated that you got nothing. You can change the code to let your MCU only receive the UTF type data. For example, send string "1" instead of integer 1.

=============

2025/03/09 Update:

Please change the custom action getConnectedDevices to:

// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:flutter_blue_plus/flutter_blue_plus.dart';

Future<List<BTDeviceStruct>> getConnectedDevices() async {
  final List<BluetoothDevice> connectedDevs = FlutterBluePlus.connectedDevices;
  final List<BTDeviceStruct> deviceList = [];
  for (final dev in connectedDevs) {
    final id = dev.remoteId.toString();
    String name = dev.platformName;
    if (name.isEmpty) {
      name = 'Unknown';
    }
    deviceList.add(BTDeviceStruct(id: id, name: name));
  }
  return deviceList;
}

Hope you guys find this blog useful!!

6
1 reply