title: flutter bluetooth issue on ios
body: <p>I face a problem when using <code>flutter blue plugin</code> (0.5.0 version).</p>
  <p>My Bluetooth device is connected only once and I can't connect another time until I close the Bluetooth on my iPhone and turn it on again.</p>
  <p>this is a video for the experiment.
  <a href="https://drive.google.com/file/d/1pQW4JFQI5R_zcxF3wfozT6Ru2AY2KxBm/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1pQW4JFQI5R_zcxF3wfozT6Ru2AY2KxBm/view?usp=sharing</a></p>
  <p>I can't use the latest plugin version because the project is old.
  this issue happened in ios only.</p>
  <p>this is my connection code:</p>
  <pre><code>_connect(BluetoothDevice d) async {
  device = d;
  // Connect to device
  deviceConnection = _flutterBlue
      .connect(device, timeout: const Duration(seconds: 4))
      .listen(
    null,
    onDone: _disconnect,
  );
  
  // Update the connection state immediately
  device.state.then((s) {
    setState(() {
      deviceState = s;
    });
  });
  
  // Subscribe to connection changes
  deviceStateSubscription = device.onStateChanged().listen((s) {
    if (mounted)
      setState(() {
        deviceState = s;
      });
    if (s == BluetoothDeviceState.connected) {
      device.discoverServices().then((s) {
        var bservice = s
            .where((r) =&gt;
            r.uuid
                .toString()
                .toLowerCase()
                .contains(&quot;0000ffe0-0000-1000-8000-00805f9b34fb&quot;))
            .first;
        if (bservice != null) {
          var char = bservice.characteristics
              .where((c) =&gt;
              c.uuid
                  .toString()
                  .toLowerCase()
                  .contains(&quot;0000ffe4-0000-1000-8000-00805f9b34fb&quot;))
              .first;
          if (char != null) {
            _setNotification(char);
          }
        }
        bservice = s
            .where((r) =&gt;
            r.uuid
                .toString()
                .toLowerCase()
                .contains(&quot;00001808-0000-1000-8000-00805f9b34fb&quot;))
            .first;
        if (bservice != null) {
          var char = bservice.characteristics
              .where((c) =&gt;
              c.uuid
                  .toString()
                  .toLowerCase()
                  .contains(&quot;00002a18-0000-1000-8000-00805f9b34fb&quot;))
              .first;
          if (char != null) {
            _setNotification(char);
          }
        }
  
        setState(() {
          //Accu-Answer isaw Service UUID=&quot;0000ffe0-0000-1000-8000-00805f9b34fb&quot;
          //Accu-Answer isaw Characteristics UUID=&quot;0000ffe4-0000-1000-8000-00805f9b34fb&quot;
          //YASEE Service UUID=&quot;00001808-0000-1000-8000-00805f9b34fb&quot;
          //YASEE Characteristics UUID=&quot;00002a18-0000-1000-8000-00805f9b34fb&quot;
  
          // var bservice=s.where((r) =&gt;r.uuid.toString().toLowerCase().contains(&quot;0000ffe0-0000-1000-8000-00805f9b34fb&quot;)).first;//Accu-Answer
          // var bservice=s.where((r) =&gt;r.uuid.toString().toLowerCase().contains(&quot;00001808-0000-1000-8000-00805f9b34fb&quot;)).first;//YASEE
          for (int i = 0; i &lt; s.length; i++) {
            var bservice = s[i];
            var tmpUUID = bservice.uuid.toString().toLowerCase();
  
            if (tmpUUID == &quot;0000ffe0-0000-1000-8000-00805f9b34fb&quot;) {
              var char = bservice.characteristics
                  .where((c) =&gt;
                  c.uuid
                      .toString()
                      .toLowerCase()
                      .contains(&quot;0000ffe4-0000-1000-8000-00805f9b34fb&quot;))
                  .first;
              if (char != null) {
                _setNotification(char);
              }
              break;
            } else if (tmpUUID == &quot;00001808-0000-1000-8000-00805f9b34fb&quot;) {
              var char = bservice.characteristics
                  .where((c) =&gt;
                  c.uuid
                      .toString()
                      .toLowerCase()
                      .contains(&quot;00002a18-0000-1000-8000-00805f9b34fb&quot;))
                  .first;
              if (char != null) {
                _setNotification(char);
              }
              break;
            }
          }
  
          //services = s;
        });
      });
    }
  });}
  </code></pre>
  <p>I'm testing on <code>iPhone 6</code> plus ios version <code>12.4.7</code></p>