tello static method
Future<Tello>
tello({
- Duration? timeout = const Duration(seconds: 12),
- Address? telloAddress,
- Address? localAddress,
- Address? stateReceiverAddress,
Serves as the constructor for the Tello class, is a static method because constructors can't be asynchronous.
Implementation
static Future<Tello> tello({
Duration? timeout = const Duration(seconds: 12),
Address? telloAddress,
Address? localAddress,
Address? stateReceiverAddress,
}) async {
stateReceiverAddress = stateReceiverAddress ??
Address(ip: InternetAddress.anyIPv4, port: 8890);
List<TelloSocket> sockets = await Future.wait([
TelloSocket.telloSocket(
telloAddress: telloAddress,
localAddress: localAddress,
timeout: timeout),
TelloSocket.telloSocket(
telloAddress: telloAddress,
localAddress: stateReceiverAddress,
timeout: timeout)
]);
Tello tello = Tello._(sockets[0], sockets[1]);
await tello._command("command");
return tello;
}