Freezed: g.dart not generating.

Created on 28 Apr 2020  路  4Comments  路  Source: rrousselGit/freezed

Hi.

I'm having the same problem of #133, the model.g.dart it is not generating.

Using the sample code:

import 'package:freezed_annotation/freezed_annotation.dart';

part 'model.freezed.dart';
part 'model.g.dart';

@freezed
abstract class Model with _$Model {
  factory Model.first(String a) = First;
  factory Model.second(int b, bool c) = Second;

  factory Model.fromJson(Map<String, dynamic> json) => _$ModelFromJson(json);
}

All packages are updated to the latest version:

dependencies:
  flutter:
    sdk: flutter
  freezed_annotation: ^0.7.1
  json_annotation: ^3.0.1

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.9.0
  freezed: ^0.10.7
  json_serializable: ^3.3.0

Most helpful comment

@pblinux Delete pubspec.lock file then run 'flutter pub get' and then run again build_runner.

All 4 comments

@pblinux Delete pubspec.lock file then run 'flutter pub get' and then run again build_runner.

Thank you @malcolmpl, that was weird but solved it.

@pblinux Delete pubspec.lock file then run 'flutter pub get' and then run again build_runner.

Solved my issue, too!

Didn't work for me and I am about to lose my mind馃槂

Was this page helpful?
0 / 5 - 0 ratings