Home > Software engineering >  Flutter print only one value from response
Flutter print only one value from response

Time:11-09

My response return:

print(response.body);

I/flutter (31140): {"code":99,"email":"[email protected]"}

How print only code or email

I/flutter (31140): {"code":99}

CodePudding user response:

I think you can use jsonDecode function from dart:convert library

import 'dart:convert';
Map<String, dynamic> myResponse= jsonDecode(response.body);
print('Code: ${myResponse['code']}  Email: ${myResponse['email']} ');
 
  • Related