Report class Null safety Models
리포트 카드 모델입니다.
- Annotations
Constructors
-
Report({required int id, Farm? farm, Cow? cow, Sensor? sensor, Gateway? gateway, required ReportGroup group, required ReportType type, List<
ActionType> ? actions, FeedbackType? feedback, int? level, int? continuedDays, Map<String, dynamic> ? cardData, required bool isPinned, required DateTime? createdAt, required DateTime? targetAt}) -
Report.fromJson(Map<
String, dynamic> json) -
factory
Properties
-
actions
↔ List<
ActionType> ? -
카드는 복수개의 액션을 가집니다.
카드상에서 그래프를 보여줄때 해당하는 액션에 대한 그래프만 보여주기 위해 이 변수를 활용합니다.
@JsonKey(name: 'actions', fromJson: actionsFromJson, toJson: actionsToJson), read / write
-
cardData
↔ Map<
String, dynamic> ? -
카드 데이터입니다.
신규 UI에서는 액션별로 지속일자와 ReportTitleId가 있고 새로운 카드 요구사항이 어떻게 바뀔지 모르기 때문에
앞으로 card_data에 json으로 데이터를 넣을려고 하는게 좋겠다는 생각입니다.
신규 UI의 경우(v1) 포맷은 다음과 같이 되어있습니다.
{
"data": {
"actions":
{"action": "ruminant", "continued_days": 1, "report_title_id": 1002}, {"action": "lactation", "continued_days": 2, "report_title_id": 1003} ...
}, "version": 1 }@JsonKey(name: 'card_data', fromJson: mapFromJson, toJson: mapToJson), read / write - continuedDays ↔ int?
-
지속일자입니다. 신규 UI에서는 액션별 지속일자가 들어가기 때문에 사용되지 않을예정입니다.
@JsonKey(name: 'continued_days'), read / write
- cow ↔ Cow?
-
소 개체 정보
@JsonKey(name: "cow_id", fromJson: cowFromCowId, toJson: cowToCowId), read / write
- createdAt ↔ DateTime?
-
카드 데이터가 생성된 날짜입니다.
@JsonKey(name: 'created_at', fromJson: dateTimeFromJson, toJson: dateTimeToJson), read / write
- farm ↔ Farm?
-
농장정보
@JsonKey(name: 'farm_id', fromJson: farmFromFarmId, toJson: farmToFarmId), read / write
- feedback ↔ FeedbackType?
-
도움됨, 도움되지않음, 모르곘음 피드백 데이터입니다. null이면 피드백이 없는 상태입니다.
@JsonKey(name: 'feedback', fromJson: feedbackFromJson, toJson: feedbackToJson), read / write
- gateway ↔ Gateway?
-
게이트웨이 정보입니다. 현재 게이트웨이 관련 카드는 발행하고 있지 않아 구현된 부분이 없을 수 있습니다.
@JsonKey(name: 'gateway_id', fromJson: gatewayFromJson, toJson: gatewayToJson), read / write
- group ↔ ReportGroup
-
리포트카드가 속한 그룹입니다.
@JsonKey(name: 'report_group', fromJson: reportGroupFromJson, toJson: reportGroupToJson), read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- id ↔ int
-
카드 아이디입니다.
@JsonKey(name: 'id'), read / write
- isPinned ↔ bool
-
고정됨 여부입니다.
@JsonKey(name: "is_pinned"), read / write
- level ↔ int?
-
단계입니다. 0 = 없음, 1 = 주의, 2 = 경계, 3 = 심각입니다.
@JsonKey(name: 'level'), read / write
- memo ↔ String?
-
메모 데이터입니다.
@JsonKey(name: 'memo'), read / write
- reportTitle → String
-
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- selfDiagnosis ↔ int?
-
자가진단 데이터의 아이디인데 자가진단기능이 현재 없기때문에 사용하지 않습니다.
@JsonKey(name: "self_diagnosis_id"), read / write
- sensor ↔ Sensor?
-
센서탈거와 같은 센서 관련 카드들은 센서정보를 가지고 있습니다.
@JsonKey(name: 'sensor_id', fromJson: sensorFromJson, toJson: sensorToJson), read / write
- targetAt ↔ DateTime?
-
createdAt이 데이터 자체가 생성된 날짜라면
targetAt은 발행된 카드가 가리키는 날짜(발행된 날짜)입니다.
앱에서는 targetAt을 쓰시면 됩니다.
@JsonKey(name: 'target_at', fromJson: dateTimeFromJson, toJson: dateTimeToJson), read / write
- type ↔ ReportType
-
리포트 타입은 센서탈거 등의 타입들이 있습니다.
확인필요 화면의 카드에서 리포트타입에 따라 다른 UI를 렌더링합니다.
필요에따라 타입을 추가하고 서버에서 카드 발행할때도 추가된 리포트타입을 주어 대응하면 됩니다.
@JsonKey(name: 'report_type', fromJson: reportTypeFromJson, toJson: reportTypeToJson), read / write
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object. [...]
override
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited