credentialToMap function
Converts json-String credential
to dart Map.
Implementation
Map<String, dynamic> credentialToMap(dynamic credential) {
if (credential is String) {
return jsonDecode(credential);
} else if (credential is Map<String, dynamic>) {
return credential;
} else {
throw Exception('unknown type for $credential');
}
}