what is the difference between Future<void> and void

107 views Asked by At

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;

} `
1

There are 1 answers

0
Bruno Simon On

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.