fromJson static method

ContactEntity fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static ContactEntity fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return ContactEntity(
      contactId: mapValueOfType<int>(json, r'ContactId'),
      entityAssetModelId: mapValueOfType<int>(json, r'EntityAssetModelId'),
      entityId: mapValueOfType<int>(json, r'EntityId'),
      dateCreated: mapDateTime(json, r'DateCreated', ''),
      dateModified: mapDateTime(json, r'DateModified', ''),
      role: ContactEntityRoleEnum.fromJson(json[r'Role']),
      entityExternalIdentifier: mapValueOfType<String>(json, r'EntityExternalIdentifier'),
      entityName: mapValueOfType<String>(json, r'EntityName'),
      entityDescription: mapValueOfType<String>(json, r'EntityDescription'),
      entity: RelatedEntity.fromJson(json[r'Entity']),
    );
  }
  return null;
}