I have a very easy question dont know why I am not able to find it anywhere I just need to print the specific value of data
My code
Future<http.Response> _trySubmit() async {
final isValid = _formKey.currentState.validate();
FocusScope.of(context).unfocus();
if (isValid) {
_formKey.currentState.save();
print(_userEmail.trim());
print(_userPassword.trim());
var map = new Map<String, dynamic>();
map['grant_type'] = 'password';
map['username'] = _userEmail.trim();
map['password'] = _userPassword.trim();
http.Response res = await http.post(
'http://sublimeapi.netcodesolution.com/token',
headers: <String, String>{
'Content-Type': 'application/x-www-form-urlencoded',
},
body: map,
);
var data = res.body;
print(data);
}
}
Its printing the value like this
I/flutter ( 5147):{"access_token":"FwYttAQIDDSRpuFFUgzznmMYgMNNfiW4OvQ4","token_type":"bearer","expires_in":86399}
I need to print just access_token value
Something like this print(data.access_token)