freezed
freezed copied to clipboard
Fail to generate class named Forecast
Describe the bug Fail to generate class named Forecast.
To Reproduce
import 'package:freezed_annotation/freezed_annotation.dart';
part 'forecast.freezed.dart';
part 'forecast.g.dart';
@freezed
class Forecast with _$Forecast {
const factory Forecast({
@Default(0) int type,
}) = _Forecast;
factory Forecast.fromJson(Map<String, dynamic> json) =>
_$ForecastFromJson(json);
}
Expected behavior Generate whiteout issue.
What is your error?
import 'package:freezed_annotation/freezed_annotation.dart';
part 'forecast.freezed.dart';
part 'forecast.g.dart';
@freezed
class beforetest with _$beforetest {
const factory beforetest({
@Default(0) int type,
}) = _beforetest;
factory beforetest.fromJson(Map<String, dynamic> json) =>
_$beforetestFromJson(json);
}
Produce the same behavior.
I think it's related to the name of the file !
import 'package:freezed_annotation/freezed_annotation.dart';
part 'beforetest.freezed.dart';
part 'beforetest.g.dart';
@freezed
class beforetest with _$beforetest {
const factory beforetest({
@Default(0) int type,
}) = _beforetest;
factory beforetest.fromJson(Map<String, dynamic> json) =>
_$beforetestFromJson(json);
}
No issues
Do you still have a problem if you restart the IDE? It sounds like an analysis issue
Alternatively maybe double-check that the file name matches your parts
Do you still have a problem if you restart the IDE? It sounds like an analysis issue
yes
Alternatively maybe double-check that the file name matches your parts
Might be, renaming the file to something other than forecast did the trick.
Edit: you can close it then ;)
I had to run flutter clean
to remove such errors.
Also a guess that removing ~/.dartServer
folder may also help.