728x90
에러 메시지
에러 원인
- null-satefy를 적용한 dart 문법에서 연산자 += 등 연산자를 줄인 형식이 허용되지 않아 발생됨
해결 방법
/// BASAL 총 값
if(basalList!.length > 0) {
basalList!.forEach((e) {
double value = e.basalAmt as double;
this.totBasalValue = this.totBasalValue !+ value;
});
}
- 값을 받을 변수를 초기화한 후 필요한 연산자를 이용해 값을 대입
아래와 같이 적용 후 사용하기
double num1 = 10;
double num2 = 20;
double? tot;
tot += num1; // 사용 X
tot += num2 // 사용 X
tot = tot !+ num1;
tot = tot !- num2;
tot = tot !* num1;
tot = tot !/ num2;
'개발자 랩실 > 플러터 (Flutter)' 카테고리의 다른 글
[Flutter] Unexpected character (at character) (0) | 2022.03.15 |
---|---|
[Flutter] The return type ‘num’ isn’t a ‘T’, as required by the closure’s context. (0) | 2022.02.23 |
[Flutter] cmdline-tools component is missing (0) | 2022.02.17 |
[Flutter] The expression has a type of ‘void’ so its value can’t be used. (0) | 2022.02.16 |
[Flutter] 달력 팝업 창 (기간 검색 시 사용) (0) | 2022.02.11 |
댓글