fromJson static method

Asset fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static Asset fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return Asset(
      assetId: mapValueOfType<int>(json, r'AssetId'),
      tenantGuid: mapValueOfType<String>(json, r'TenantGuid'),
      name: mapValueOfType<String>(json, r'Name'),
      models: ApiClient.listFromJson(json[r'Models']),
      segments: ApiClient.listFromJson(json[r'Segments']),
      roles: Role.listFromJson(json[r'Roles']),
      permissions: UserPermissions.fromJson(json[r'Permissions']),
      dateCreated: mapDateTime(json, r'DateCreated', ''),
      dateModified: mapDateTime(json, r'DateModified', ''),
      state: AssetStateEnum.fromJson(json[r'State']),
    );
  }
  return null;
}