fromJson static method
Returns a new Formation instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static Formation? 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 "Formation[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "Formation[$key]" has a null value in JSON.');
});
return true;
}());
return Formation(
alreadyIncorporated: mapValueOfType<bool>(json, r'alreadyIncorporated'),
capTableImported: mapValueOfType<bool>(json, r'capTableImported'),
createdAt: mapValueOfType<int>(json, r'createdAt'),
documentIds: json[r'documentIds'] is Iterable
? (json[r'documentIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
esignRef: mapValueOfType<String>(json, r'esignRef'),
filing: Filing.fromJson(json[r'filing']),
founders: Founder.listFromJson(json[r'founders']),
genesis: Genesis.fromJson(json[r'genesis']),
imported: mapValueOfType<bool>(json, r'imported'),
importedDocs: json[r'importedDocs'] is Iterable
? (json[r'importedDocs'] as Iterable).cast<String>().toList(growable: false)
: const [],
jurisdiction: mapValueOfType<String>(json, r'jurisdiction'),
name: mapValueOfType<String>(json, r'name'),
org: mapValueOfType<String>(json, r'org'),
paid: mapValueOfType<bool>(json, r'paid'),
paymentRef: mapValueOfType<String>(json, r'paymentRef'),
signed: mapValueOfType<bool>(json, r'signed'),
stage: mapValueOfType<String>(json, r'stage'),
structure: mapValueOfType<String>(json, r'structure'),
updatedAt: mapValueOfType<int>(json, r'updatedAt'),
);
}
return null;
}