pairDevice method
Sends a device pairing handshake to the dev server at host:port.
Implementation
Future<bool> pairDevice({
required String host,
required int port,
required String deviceName,
required String platform,
}) async {
final url = Uri.parse('http://$host:$port/devices/pair');
final response = await _httpClient.post(
url,
headers: {'Content-Type': 'application/json'},
body: jsonEncode({
'name': deviceName,
'platform': platform,
'timestamp': DateTime.now().toIso8601String(),
}),
).timeout(const Duration(seconds: 5));
return response.statusCode == 200;
}