Skip to content

Instantly share code, notes, and snippets.

@sbis04
Created March 4, 2019 17:53
Show Gist options
  • Save sbis04/dc74c1b373685f76d4ee0a33c4840acc to your computer and use it in GitHub Desktop.
Save sbis04/dc74c1b373685f76d4ee0a33c4840acc to your computer and use it in GitHub Desktop.
_getDeviceItems( ) method
...
// Create the List of devices to be shown in Dropdown Menu
List<DropdownMenuItem<BluetoothDevice>> _getDeviceItems() {
List<DropdownMenuItem<BluetoothDevice>> items = [];
if (_devicesList.isEmpty) {
items.add(DropdownMenuItem(
child: Text('NONE'),
));
} else {
_devicesList.forEach((device) {
items.add(DropdownMenuItem(
child: Text(device.name),
value: device,
));
});
}
return items;
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment