• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

g.dart 파일이 생성이 안됩니다.

23.01.17 01:40 작성 23.01.17 01:42 수정 조회수 1.38k

0

import 'package:json_annotation/json_annotation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'note.freezed.dart';
part 'note.g.dart';

@freezed
class Note with _$Note {
  factory Note({
    required String title,
    required String content,
    required int color,
    required int timestamp,
    int? id,
  }) = _Note;

  factory Note.formJson(Map<String, dynamic> json) => _$NoteFromJon(json);
}

g.dart 파일이 생성이 안됩니다.

flutter pub run build_runner build

flutter pub run build_runner clean

flutter pub run build_runner build --delete-conflicting-outputs

이거 해 보았는데 안됩니다.

provider: ^6.0.5
sqflite: ^2.2.3
json_annotation: ^4.7.0
freezed_annotation: ^2.2.0
flutter_lints: ^2.0.1
json_serializable: ^6.5.4
freezed: ^2.3.2
build_runner: ^2.3.3

처음엔 강의 대로 버전 맞춰서 했는데 안되서 최신으로 했는데 그래도 안됩니다~

도와 주십시요~ 강의를 시작도 못하고 있습니다~ ㅜㅜ

답변 1

답변을 작성해보세요.

0

여기에 오타가 있습니다. 뒷부분에 _$NoteFromJson 인데 s가 빠졌습니다.

factory Note.formJson(Map<String, dynamic> json) => _$NoteFromJon(json);

제가 사용하는 라이브템플릿 공유해 드렸는데요. 참고하셔서 설정하시면 오타없이 하실 수 있습니다.

https://gravel-pike-705.notion.site/Flutter-Live-Templeate-579bac3070754bdf8fa10afe4ebe8c92

김의성님의 프로필

김의성

질문자

2023.01.19

감사합니다 ㅜㅜ