sentUserData method

Future<void> sentUserData({
  1. required String userId,
})

Implementation

Future<void> sentUserData({required String userId}) async {
  if (host == null || port == null) return;
  final url = Uri.parse('http://$host:$port/sentUserData');

  try {
    final response = await http.post(
      url,
      body: jsonEncode({'start': userId}),
      headers: {'Content-Type': 'application/json'},
    );
    print('Response: ${response.body}');

      connected = true;

  } catch (e) {
    print('Error sending: $e');
  }
  notifyListeners();
}