fromJson static method
Returns a new CaptableShareClass instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CaptableShareClass? 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 "CaptableShareClass[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "CaptableShareClass[$key]" has a null value in JSON.');
});
return true;
}());
return CaptableShareClass(
classType: mapValueOfType<String>(json, r'classType'),
companyName: mapValueOfType<String>(json, r'companyName'),
conversionRights: mapValueOfType<String>(json, r'conversionRights'),
id: mapValueOfType<String>(json, r'id'),
idx: mapValueOfType<int>(json, r'idx'),
initialSharesAuthorized: mapValueOfType<int>(json, r'initialSharesAuthorized'),
liquidationPreferenceMultiple: num.parse('${json[r'liquidationPreferenceMultiple']}'),
name: mapValueOfType<String>(json, r'name'),
parValue: num.parse('${json[r'parValue']}'),
participationCapMultiple: num.parse('${json[r'participationCapMultiple']}'),
prefix: mapValueOfType<String>(json, r'prefix'),
pricePerShare: num.parse('${json[r'pricePerShare']}'),
seniority: mapValueOfType<int>(json, r'seniority'),
votesPerShare: mapValueOfType<int>(json, r'votesPerShare'),
);
}
return null;
}