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

can't resolve null value – Flutter

enter image description here I am facing this error that Null check operatorr Null check operator used on a null value The relevant error-causing widget was: MaterialApp MaterialApp:file:///D:/Flutter%20Projects/bmi_calculator/lib/main.dart:12:12 When the exception was thrown, this was the stack: #0 CalculatorBrain.getResult (package:bmi_calculator/bmi_calculator.dart:17:11)…

VIEW QUESTION
Back To Top
Search