fromJson static method

CaptableShareIn? fromJson(
  1. dynamic value
)

Returns a new CaptableShareIn instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static CaptableShareIn? 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 "CaptableShareIn[$key]" is missing from JSON.');
        assert(json[key] != null, 'Required key "CaptableShareIn[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return CaptableShareIn(
      boardApprovalDate: mapValueOfType<Object>(json, r'boardApprovalDate'),
      capitalContribution: mapValueOfType<Object>(json, r'capitalContribution'),
      certificateId: mapValueOfType<Object>(json, r'certificateId'),
      cliffYears: mapValueOfType<Object>(json, r'cliffYears'),
      companyLegends: json[r'companyLegends'] is Iterable
          ? (json[r'companyLegends'] as Iterable).cast<Object>().toList(growable: false)
          : const [],
      debtCancelled: mapValueOfType<Object>(json, r'debtCancelled'),
      ipContribution: mapValueOfType<Object>(json, r'ipContribution'),
      issueDate: mapValueOfType<Object>(json, r'issueDate'),
      otherContributions: mapValueOfType<Object>(json, r'otherContributions'),
      pricePerShare: mapValueOfType<Object>(json, r'pricePerShare'),
      quantity: mapValueOfType<Object>(json, r'quantity'),
      rule144Date: mapValueOfType<Object>(json, r'rule144Date'),
      shareClassId: mapValueOfType<Object>(json, r'shareClassId'),
      stakeholderId: mapValueOfType<Object>(json, r'stakeholderId'),
      status: mapValueOfType<Object>(json, r'status'),
      vestingStartDate: mapValueOfType<Object>(json, r'vestingStartDate'),
      vestingYears: mapValueOfType<Object>(json, r'vestingYears'),
    );
  }
  return null;
}