fromJson static method
IamKey?
fromJson(
- dynamic value
)
Returns a new IamKey instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static IamKey? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "IamKey[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "IamKey[$key]" has a null value in JSON.');
});
return true;
}());
return IamKey(
accessKey: mapValueOfType<String>(json, r'accessKey'),
accessSecret: mapValueOfType<String>(json, r'accessSecret'),
accessSecretDigest: mapValueOfType<String>(json, r'accessSecretDigest'),
act: mapValueOfType<bool>(json, r'act'),
application: mapValueOfType<String>(json, r'application'),
createdAt: mapDateTime(json, r'createdAt', r''),
createdTime: mapValueOfType<String>(json, r'createdTime'),
deleted: mapValueOfType<bool>(json, r'deleted'),
displayName: mapValueOfType<String>(json, r'displayName'),
expireTime: mapValueOfType<String>(json, r'expireTime'),
id: mapValueOfType<String>(json, r'id'),
name: mapValueOfType<String>(json, r'name'),
organization: mapValueOfType<String>(json, r'organization'),
owner: mapValueOfType<String>(json, r'owner'),
scope: mapValueOfType<String>(json, r'scope'),
state: mapValueOfType<String>(json, r'state'),
type: mapValueOfType<String>(json, r'type'),
updatedAt: mapDateTime(json, r'updatedAt', r''),
updatedTime: mapValueOfType<String>(json, r'updatedTime'),
user: mapValueOfType<String>(json, r'user'),
);
}
return null;
}