0

I'm writing a code in flutter and don't know what is the difference between them

` Future senddata(BluetoothDevice d) async {

 BluetoothConnection? connection;

connection = await BluetoothConnection.toAddress(d.address);

connection.output.add(Uint8List.fromList(utf8.encode("irgendwas"))); 

await connection.output.allSent;

} `
Tawfde
  • 1
  • 1
    Duplicated Question. Answer here: [Future vs void](https://stackoverflow.com/a/59833075/4605422) – Canilho Aug 09 '23 at 16:32

1 Answers1

0

If you declare a method as Future you can await it
If you declared only as void you can't await

Examples

A void method can be async, but it cannot be awaited.