If my response from my API looks like this.
{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email has already been taken."
]
}
}
How can I get the first key in the errors in dart? Currently I am doing
var body = json.decode(response.body);
print(body['errors']['email']);
But ['email'] could be dynamic, I just want whatever the first entry is of the errors