에러 메시지를 대하는 방향성에 대한 질문이에요 (플러터 왕초보)
405
작성자 없음
작성한 질문수 0
안녕하세요.. 쌤 강의를 열심히 듣고 공부하고 있는 플러터 초보입니다. 제가 완전 초보라서 그런지 에러가 뜨면 어떻게 고쳐야 할지 모르겠어요 ㅠㅠ 이미 망해서.. 손 놓고 쌤 강의 마저 듣고 이번 프로젝트는 마무리 하려고 합니다. 해결 방법을 아예 모르겠어요. 현 상황을 설명해 드릴게요.
캘린더_스케쥴러 강의 막바지에 발생했습니다. 이전 강의는 모두 잘 따라갔음
<처음 에러가 뜬 시점은 schedulebottomsheet>
child: GestureDetector(
onTap: () async {
await showModalBottomSheet<ScheduleTable>(
context: context,
builder: (_) {
return ScheduleBottomSheet(
selectedDay: selectedDay,
);
},
);<아래의 에러 메시지도 함께 떴는데, 해결 방법을 몰라 귿대로 코딩 진행함>
lib/screen/home_screen.dart:144:63: Error: Required named parameter 'id' must be provided.
return ScheduleBottomSheet(
^
lib/component/schedule_bottom_sheet.dart:14:9: Context: Found this candidate, but the arguments don't match.
const ScheduleBottomSheet({
^^^^^^^^^^^^^^^^^^^
<결국 아래처럼 에러 메시지가 쌓여서 손을 놓게 됨>
lib/screen/home_screen.dart:144:63: Error: Required named parameter 'id' must be provided.
return ScheduleBottomSheet(
^
lib/component/schedule_bottom_sheet.dart:14:9: Context: Found this candidate, but the arguments don't match.
const ScheduleBottomSheet({
^^^^^^^^^^^^^^^^^^^
lib/screen/home_screen.dart:65:21: Error: The getter 'schedule' isn't defined for the class '_HomeScreenState'.
- '_HomeScreenState' is from 'package:calendar_scheduler/screen/home_screen.dart' ('lib/screen/home_screen.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'schedule'.
id: schedule.id,
^^^^^^^^
lib/component/schedule_bottom_sheet.dart:41:61: Error: The getter 'waiting' isn't defined for the class 'ConnectionState'.
- 'ConnectionState' is from 'package:flutter/src/widgets/async.dart' ('../../flutter_windows_3.22.2-stable/flutter/packages/flutter/lib/src/widgets/async.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'waiting'.
if (widget.id != null && snapshot.connectionState.waiting) {
^^^^^^^
lib/component/schedule_bottom_sheet.dart:43:22: Error: The argument type 'Type' can't be assigned to the parameter type 'Widget?'.
- 'Type' is from 'dart:core'.
- 'Widget' is from 'package:flutter/src/widgets/framework.dart' ('../../flutter_windows_3.22.2-stable/flutter/packages/flutter/lib/src/widgets/framework.dart').
child: CircularProgressIndicator,
^
lib/component/schedule_bottom_sheet.dart:220:17: Error: No named parameter with the name 'initialValue'.
initialValue: startTimeInitValue,
^^^^^^^^^^^^
lib/component/custom_text_field.dart:10:9: Context: Found this candidate, but the arguments don't match.
const CustomTextField({
^^^^^^^^^^^^^^^
lib/component/schedule_bottom_sheet.dart:229:17: Error: No named parameter with the name 'initialValue'.
initialValue: endTimeInitValue,
^^^^^^^^^^^^
lib/component/custom_text_field.dart:10:9: Context: Found this candidate, but the arguments don't match.
const CustomTextField({
^^^^^^^^^^^^^^^
lib/component/schedule_bottom_sheet.dart:259:9: Error: No named parameter with the name 'initialValue'.
initialValue: initialValue,
^^^^^^^^^^^^
lib/component/custom_text_field.dart:10:9: Context: Found this candidate, but the arguments don't match.
const CustomTextField({
^^^^^^^^^^^^^^^
요약
<캘린더 스케쥴러 - 기존 일정 업데이트하는 기능 만들기 강의> 초반부에서 제가 키를 잘못 눌렀는지, ScheduleBottomSheet에 밑줄이 그어졌어요. 근데 그냥 무시하고 강의를 들으면서 쭉 코딩을 해서 오류 메시지가 쌓인 것입니당
이때 느낀게, 코드가 한 번 꼬이면 뒤까지 모두 지장을 주는 구나라는 것을 알게 되었어요. 만약 초보인 제가 코드 에러를 마주했을 때 어떤식으로 해결을 해야하는 지 알려주실 수 있나요 ??
스케쥴러에서는 구조가 복잡해 지다 보니 특정 오류나 오타를 잡아 내는 것이 좀 벅차다는 느낌을 받았습니다. 하하.. 아니면 코드가 복잡해 진다 싶으면 챕터별로 나누어서 저장하는 것도 방법인지? 궁금하네요.
답변 2
0
안녕하세요!
초보자분들이 흔히 생각하는게 "에러 메세지는 나쁜거다!"입니다.
하지만 시간이 지나면 알게 되겠지만 "에러 메세지는 매우 좋은 것"입니다.
빌드타임 에러가 있다면 어떤 문제가 존재하는지 알 수 있고 정확히 문제가 뭔지도 알려주기 때문입니다.
초보자 분들이 에러를 해결하기 어려워하는 가장 큰 이유는 "에러를 읽어보지 않기때문"입니다.
플러터처럼 잘 짜여진 프레임워크들은 에러 메세지가 매우 잘 설계돼있습니다.
보여주신 에러 메세지에도 벌써 어떤게 문제인지 쉽게 알 수 있습니다.
lib/screen/home_screen.dart:144:63: Error: Required named parameter 'id' must be provided.
return ScheduleBottomSheet(
이 메세지를 첨부해주셨는데 심지어 위치까지 정확히 알려줍니다.
lib/screen/home_screen.dart 144번줄에 에러가 있다고 알려주고 있네요.
에러 메세지는 Required named parameter 'id' must be provided.
한글로 번역하면 어떻게 될까요?
"필수 네임드 파라미터 'id'가 제공돼야합니다." 정도로 생각 해볼 수 있습니다.
어떤가요? 그냥 읽어보기만해도 쉽지 않나요? 메세지에서 저희가 이미 배우지 않은, 알지 못하는 내용은 없습니다.
너무 어렵게 생각하지말고 일단 읽어보는게 가장 중요합니다.
읽어보고 해석해도 "무슨말인지 모르겠다"면 그때 다양한 방법으로 도움을 받아보면 됩니다! (검색등)
감사합니다!
198강 (){onTap(e);}의 이해 돕기
0
26
1
video_call 플러그인 설치후 에러 발생
0
45
1
SDK 안드로이드 설치 질문!
0
60
1
코드팩토리 디스코드 링크 다시 부탁드려요~
0
92
1
Webview를 이용해서 URL 상의 페이지 출력 불가
0
70
1
홈스크린 함수를 함축해서 main.dart에 옮기는 문제
0
55
1
플레이스토어
0
59
1
아고라 엔진 init 함수의 반환타입이 Future<void> 이것의 의미는 무엇인가요?
0
55
1
가이드라인 질문
0
57
0
emulator 에러 환경설정 뭐가 문제 일까요??
0
76
1
emulator 실행 오류
0
93
3
Column을 가로방향 최대 사이즈를 차지하도록 하는 방법에 관련
0
71
1
pubspec.yaml에서 font를 추가하면서 weight 값을 지정하는 것이 의미가 있는 것인지 문의
0
43
1
setState()를 호출하지 않으면 build가 실행 안되는 건가요?
0
53
1
video_call 플러그인 설치시 에러문제
0
64
1
children 안의 if 문에서 { } 못쓰는 이유?
0
48
1
이렇게 오류가 떠요
0
63
1
AppBar 사용했는데
0
61
2
[문제해결] '오늘도 출첵!' 의 171번 강의에서 중요한 문제를 발견했습니다
0
56
1
StatefulWidget 실습 에러가 발생합니다.[해결완료]
0
63
1
Video Player 프로젝트에 대한 추가 질문
0
53
0
Row위젯이나 column위젯의 위치는 누가 정하나요??
0
42
1
geolocator 오류때문에 개발진행이 불가능입니다
0
63
1
API 관련 이슈
0
86
2





