에러가 생겨서
109
23 câu hỏi đã được viết
소스대로 했는데
에러가 생기네요
78, 79 번째줄 text 에서 에러입니다.
에러 메세지는
Running Gradle task 'assembleDebug'...
lib/chat_page.dart:78:63: Error: The getter 'text' isn't defined for the class 'Part'.
- 'Part' is from 'package:flutter_gemini/src/models/part/part.dart' ('/C:/Users/userpc/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_gemini-3.0.0/lib/src/models/part/part.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'text'.
? HumanMessage(content: chat.parts?.first.text ?? '')
^^^^
lib/chat_page.dart:79:60: Error: The getter 'text' isn't defined for the class 'Part'.
- 'Part' is from 'package:flutter_gemini/src/models/part/part.dart' ('/C:/Users/userpc/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_gemini-3.0.0/lib/src/models/part/part.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'text'.
: AIMessage(content: chat.parts?.first.text ?? '');
^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
Exception: Gradle task assembleDebug failed with exit code 1
혹시
25, 34 번째줄 Parts 에 안쓴다는 줄 쳐졌는데
관계가 있나요

Câu trả lời 1
0
안녕하세요! 질문으로 올려주셔서 감사합니다.
디버깅을 해보니 flutter_gemini가 버전업이 되면서, 사용법이 바뀌었고, 와중에 freezed를 활용한 타입선언에는 에러가 있네요. 아래와 같이 변경해서 사용해주시면 됩니다.
// setState해서 UI를 변경하는 부분
setState(() {
chatList = [
...chatList,
// Content(role: 'model', parts: [Parts(text: value?.output)]) //기존 2.x 버전
Content(role: 'model', parts: [Part.text(value?.output ?? '')]) // 3.x 버전
];
});
그리고 채팅 내역을 보여주는 부분은 type casting을 해줘야합니다.
itemBuilder: (context, index) {
final chat = chatList[index];
Widget messageWidget = chat.role == 'user'
? HumanMessage(content: chat.parts?.first is TextPart ? (chat.parts?.first as TextPart).text : '')
: AIMessage(content: chat.parts?.first is TextPart ? (chat.parts?.first as TextPart).text : '');
return messageWidget;
},덕분에 저도 강의자료를 업데이트했는데요, 빠른시일내에 촬영해서 내용을 수정해야 할 것 같습니다
감사합니다!
커서 디스플레이
0
19
1
VKOSPI의 KRX open API 사용 download?
0
16
0
폴더가 엉킨것같아요..
0
17
1
섹션 11은 언제 업데이트 되나요?
0
20
0
강의영상에 있는 anthropic docs 사이트가 없는데 어디로 들어가면되나요
0
23
2
배포방법
0
33
1
첫번째 영상 고화질 만드는 방법
0
19
0
Codex로는 할수 없나요?
0
23
1
lab/cs-crew 관련 질문
0
21
1
C:\Users\사용자\.claude 위치에 ClLAUDE.md 파일이 없는데요
0
24
2
5.8 문의
0
29
2
대본 오디오 생성 강의 마지막시트 에러 질문
0
24
0
저장버튼을 눌렀는데도 비어있다고 나옵니다
0
29
2
5.6 문의
0
22
1
강사님 claude.md 가 궁금합니다.
0
30
2
fal ai 에서 http가 안뜹니다.
0
29
2
cursor ide 상의 claude 창
0
32
2
VIDEO URL 업로드 오류
0
26
0
github CodeCraft Collaborator 관련 질문
0
32
1
유닛3.8 회사 지식베이스 구축 시 05-네이밍-브랜드보이스.md 파일이 생성되지 않습니다.
0
26
0
종목당 매수금액 = 예수금의 1/n ( n = 최종Buy 선택종목수)?
0
29
2
또다른 오버플로우
0
98
2
오버플로우
0
135
2
실전강의는 무엇인가요?
1
149
1

