start method
Implementation
Future<void> start(Uint8List peerId, int port) async {
if ((await Connectivity().checkConnectivity())
.contains(ConnectivityResult.wifi)) {
try {
_registration ??= await register(
Service(
name: serviceName,
type: serviceType,
port: port,
txt: {
_txtPeerId: _utf8Encoder.convert(base64Encode(peerId)),
},
),
).timeout(timeout);
} catch (e) {
if (kDebugMode) print(e);
}
try {
_discovery ??=
await startDiscovery(serviceType, ipLookupType: IpLookupType.any)
.timeout(timeout)
..addServiceListener(_onServiceFound);
} catch (e) {
if (kDebugMode) print(e);
}
}
}