인프런 커뮤니티 질문&답변

위시드님의 프로필 이미지

작성한 질문수

[2024 최신] [코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!

기존 일정 업데이트하는 기능 만들기

에러 메시지를 대하는 방향성에 대한 질문이에요 (플러터 왕초보)

24.07.23 21:37 작성

·

101

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

위시드님의 프로필 이미지
위시드
질문자

2024. 07. 26. 17:33

제가 원래 영어는 잘하는 편인데도 불구하고, 이 업계의 영어를 접하면 답답한 느낌이 많이 들더라고요. 해석은 되어도 해설이 안된다고 해야할까요? 여튼 코팩님이 말씀하신대로, 에러메시지에 대한 생각을 달리해보고, 많은 다큐멘터리를 접해 보도록 하겠습니다 ! 감사합니다 🙂 어제 코팩님 플러터 책 두꺼운거 새로 샀는데, 다시 독하게 해보려고요. 좋은 강의 감사합니다.

코드팩토리님의 프로필 이미지
코드팩토리
지식공유자

2024. 07. 28. 12:37

막히시면 언제든 질문 주세요!

0

코드팩토리님의 프로필 이미지
코드팩토리
지식공유자

2024. 07. 24. 10:57

안녕하세요!

초보자분들이 흔히 생각하는게 "에러 메세지는 나쁜거다!"입니다.

하지만 시간이 지나면 알게 되겠지만 "에러 메세지는 매우 좋은 것"입니다.

빌드타임 에러가 있다면 어떤 문제가 존재하는지 알 수 있고 정확히 문제가 뭔지도 알려주기 때문입니다.

 

초보자 분들이 에러를 해결하기 어려워하는 가장 큰 이유는 "에러를 읽어보지 않기때문"입니다.

플러터처럼 잘 짜여진 프레임워크들은 에러 메세지가 매우 잘 설계돼있습니다.

보여주신 에러 메세지에도 벌써 어떤게 문제인지 쉽게 알 수 있습니다.

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'가 제공돼야합니다." 정도로 생각 해볼 수 있습니다.

어떤가요? 그냥 읽어보기만해도 쉽지 않나요? 메세지에서 저희가 이미 배우지 않은, 알지 못하는 내용은 없습니다.

너무 어렵게 생각하지말고 일단 읽어보는게 가장 중요합니다.

읽어보고 해석해도 "무슨말인지 모르겠다"면 그때 다양한 방법으로 도움을 받아보면 됩니다! (검색등)

감사합니다!