0

ok here is my json format

{ 
  "success":true,
  "user":{
           "name":"example"
           "email:"[email protected]"
         }
}

ok by using Chopper Flutter it was easy just to get the user object by calling

response.body["user"]

however the current Chopper version ie the null safety is not stable...so how do you call this method in HTTP? to get the user object only...

1 Answer 1

3
Response response = await http.get(Uri.parse('enterYourUrlHere');
Map<String, dynamic> body = jsonDecode(response.body);
var user = body['user'];
print(user['email']); // prints out [email protected]"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.