skip to Main Content

Flutter – Why I can't check if `response.body` is null or not?

I am trying to see if a username already exist in the database or not, using the following code: Future<bool> checkUsername(userName) async { try { final response = await http.post( Uri.parse('http://10.0.2.2:3000/username'), headers: {'Content-Type': 'application/json'}, body: json.encode({'user_name': userName}), ); print('response ${response.body}');…

VIEW QUESTION
Back To Top
Search