fromJson static method

AuditLog? fromJson(
  1. dynamic value
)

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

Implementation

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

    return AuditLog(
      auditId: mapValueOfType<int>(json, r'AuditId'),
      auditData: mapValueOfType<String>(json, r'AuditData')!,
      entityType: mapValueOfType<String>(json, r'EntityType'),
      tablePk: mapValueOfType<String>(json, r'TablePk'),
      requestId: mapValueOfType<String>(json, r'RequestId'),
      auditDate: mapDateTime(json, r'AuditDate', ''),
      auditAction: mapValueOfType<String>(json, r'AuditAction'),
      applicationUserId: mapValueOfType<String>(json, r'ApplicationUserId'),
      applicationUser: TicketApplicationUser.fromJson(json[r'ApplicationUser']),
    );
  }
  return null;
}