title: How do I show a tick mark on the connected bluetooth device in Flutter?
body: <p>So I need to show a tick mark alongside the connected bluetooth device and I want the tick mark to show through the entire app session if the bluetooth device is connected. The functionality that I have kept is,</p>
  <p>1- We tap on the bluetooth device.</p>
  <p>2- The tick mark appears on the right of the selected bluetooth device.</p>
  <p>3- Then we tap on the connect button to connect to the device.</p>
  <p>The tick mark does not appear on the right of selected bluetooth device <strong>after I come back on the screen</strong>.</p>
  <p>So far the method I have tried is:</p>
  <ul>
  <li>To set the tick mark in Visibility widget and save the boolean of visible in SharedPreferences to save the status throughout the app session, but it doesn't seem to work.</li>
  </ul>
  <p>I would like the tick mark to stay alongside the connected bluetooth device if its connected and throughout the app session it should appear there even if i come to the screen.</p>
  <p>Here is the code for streambuilder that prints the list of bluetooth devices:</p>
  <pre><code>StreamBuilder&lt;List&lt;BluetoothDevice&gt;&gt;(
                    stream: bluetoothPrint.scanResults,
                    initialData: [],
                    builder: (c, snapshot) =&gt; snapshot.data != null
                      ? Column(
                      children: snapshot.data!.map((d) =&gt; ListTile(
                        title: Text(d.name??''),
                        subtitle: Text(d.address.toString()),
                        onTap: (){
                          setState(() {
                            _device = d;
                            globalDevice = _device;
                          });
                        },
                        trailing: _device?.address==d.address?
                        Text('connected'): Text('not connected'),
                      )).toList(),
                    )
                      : Column(
                      children: [
                        SizedBox(height: 220),
                        Text(
                          &quot;No bluetooth devices in range.&quot;,
                          style: TextStyle(
                              fontWeight: FontWeight.bold,
                              fontSize: 16.0,
                              color: Colors.black),
                          textAlign: TextAlign.center,
                        ),
                      ],
                    )
                  ),
  
  </code></pre>