fromJson static method
Returns a new RoleSetMigration instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static RoleSetMigration? 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 "RoleSetMigration[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "RoleSetMigration[$key]" has a null value in JSON.');
});
return true;
}());
return RoleSetMigration(
object: RoleSetMigrationObjectEnum.fromJson(json[r'object'])!,
id: mapValueOfType<String>(json, r'id')!,
organizationId: mapValueOfType<String>(json, r'organization_id'),
instanceId: mapValueOfType<String>(json, r'instance_id')!,
sourceRoleSetId: mapValueOfType<String>(json, r'source_role_set_id')!,
destRoleSetId: mapValueOfType<String>(json, r'dest_role_set_id'),
triggerType: mapValueOfType<String>(json, r'trigger_type')!,
status: mapValueOfType<String>(json, r'status')!,
migratedMembers: mapValueOfType<int>(json, r'migrated_members')!,
mappings: mapCastOfType<String, String>(json, r'mappings') ?? const {},
startedAt: mapValueOfType<int>(json, r'started_at'),
completedAt: mapValueOfType<int>(json, r'completed_at'),
createdAt: mapValueOfType<int>(json, r'created_at')!,
updatedAt: mapValueOfType<int>(json, r'updated_at')!,
);
}
return null;
}