title: Flutter bluetooth scan - Not detecting raspberry
body: <p>Hello everyone and thank you to read this.</p>
  <p>So I have a script that configure bluetooth to my raspberry pi 4 and make him discoverable.</p>
  <p>In the other hand I have a flutter app that detect bluetooth devices and show them in a list.</p>
  <p>ISSUE :
  The flutter app doesn't detect my raspberry but detect all the others devices (bluetooth speaker, headphones...).
  When I go in the native scan bluetooth of my android phone - the raspberry is detected and I can connect to him.</p>
  <p>Someone have a guess why the app doesn't detect the raspberry ?</p>
  <p>Thank you</p>
  <p>This is the code from the raspberry script :</p>
  <pre><code>...
  
  # Coproc functions
  function sendCmd() {
      echo &quot;$1&quot; &gt;&amp;&quot;${bluetooth[1]}&quot;
      read -r clean &lt;&amp;&quot;${bluetooth[0]}&quot;
      while [[ ! -z $clean ]]
      do
          read -r -t 1 clean &lt;&amp;&quot;${bluetooth[0]}&quot;
      done
  }
  
  # All commands for bluetoothctl
  declare -a commands=(&quot;power on&quot; &quot;pairable on&quot; 'discoverable on' 'agent on' 'default-agent')
  
  # Start Coproc with bluetoothclt binding the process with 'bluetooth' name
  echo -e &quot;[CONFIGURATION] started&quot;
  coproc bluetooth {
      bluetoothctl;
  }
  
  for cmd in &quot;${commands[@]}&quot;
  do
      echo -ne &quot;\t'$cmd' &quot;
      sendCmd &quot;$cmd&quot;
      echo 'done.'
  done
  echo -e &quot;[CONFIGURATION] ended\n&quot;
  
  ...
  </code></pre>
  <p><strong>This is the code from the flutter app :</strong></p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_blue/flutter_blue.dart';
  
  void main() {
    runApp(BluetoothApp());
  }
  
  class BluetoothApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'BluetoothApp',
        home: Home(),
      );
    }
  }
  
  class Home extends StatefulWidget {
    Home() : super();
  
    HomeState createState() =&gt; HomeState();
  }
  
  class HomeState extends State&lt;Home&gt; {
    FlutterBlue flutterBlue = FlutterBlue.instance;
    List&lt;BluetoothDevice&gt; devices = List&lt;BluetoothDevice&gt;();
  
    @override
    void initState() {
      super.initState();
  
      _scanForDevices();
    }
  
    void _scanForDevices() async {
      print('Scanning...');
      flutterBlue.scan().listen((event) {
        if (!devices.contains(event.device)) {
          setState(() {
            devices.add(event.device);
          });
        }
      }).onError((err) {
        print('Error =&gt; ' + err.toString());
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: SafeArea(
          child: Column(children: [
            Expanded(
              child: ListView.builder(
                itemCount: devices.length,
                itemBuilder: (context, index) {
                  return ListTile(
                    title: Text(devices[index].name.length &gt; 0
                        ? devices[index].name
                        : '[no name]'),
                    subtitle:
                        Text('Mac address : ' + devices[index].id.toString()),
                  );
                },
              ),
            ),
          ]),
        ),
      );
    }
  }
  </code></pre>