-
카테고리
-
세부 분야
모바일 앱 개발
-
해결 여부
미해결
onDaySelected가 타입이 아니라고 나오네요 그리고
23.08.29 01:51 작성 조회수 253
0
안녕하세요.
섹션21 TodayBanner 설계 강좌에서
아래와 같은 에러 메시지가 나와서 더 이상 진행이 안 됩니다.
final onDaySelected? onDaySelected;
에서 onDaySelected가 타입이 아니라고 나오네요.
강좌에서 밖으로/위로(?) 빼는 작업과 statefull로 바꾸는 과정에서부터 에러가 나와서 여기서 막혀 더 이상 강의를 따라하며 들을 수 없습니다.
혹시나 해서 소스 코드를 깃허브에 올려 두었습니다.
소스코드는 아래에 있습니다.
https://github.com/kooboom/calendar_scheduler
lib/component/calendar.dart:12:9: Error: The name of a constructor must match the name of the enclosing class.
const Calendar({
^^^^^^^^
lib/component/calendar.dart:9:9: Error: 'onDaySelected' isn't a type.
final onDaySelected? onDaySelected;
^^^^^^^^^^^^^
lib/component/calendar.dart:9:24: Context: This isn't a type.
final onDaySelected? onDaySelected;
^^^^^^^^^^^^^
lib/screen/home_screen.dart:28:13: Error: The method 'Calendar' 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 method, or defining a method named 'Calendar'.
Calendar(
소스코드는 아래에 있습니다.
https://github.com/kooboom/calendar_scheduler
답변을 작성해보세요.
0
쿠붐
질문자2023.08.29
나머지 2가지 해결되었습니다. StatelessWidget으로 변경하면서, CalendarState에서 State를 삭제 안 했네요.
class CalendarState extends StatelessWidget
를 class Calendar extends StatelessWidget 로 고쳤습니다.
0
코드팩토리
지식공유자2023.08.29
안녕하세요!
onDaySelected가 타입이 아닙니다로 나오는 이유는 아마 실제로 타입으로 선언하시지 않아서 그럴겁니다. (IDE는 거짓말을 안합니다)
onDaySelected로 선언하신게 아니고 OnDaySelected (첫글자 대문자) 확인해보세요!
감사합니다~!
쿠붐
질문자2023.08.29
안녕하세요. 나머지 2가지 에러는 어떻게 수정하면 되는지요? 찾는다고 찾는데 쉽지 않네요.
눈을 한 번 다친 후로는 시력이 좋지 않아,
IDE의 도움을 받아도 글자 크기를 비롯한 여러 오타 발견하기가 무척 어렵네요.
바쁘신데 답변 감사 드립니다.
답변 2