What are the differences between @Freezed() and @freezed annotations ?
In official freezed documentation the @freezed annotation used.
But there are some tutorials like this Medium post where @Freezed() annotation used instead.
I tried both and in my case didn't find any difference
@freezed
class Post with _$Post {
const factory Post({
required int id,
required String title,
required String text,
required String imageUrl,
}) = _Post;
factory Post.fromJson(Map<String, dynamic> json) => _$PostFromJson(json);
}
You can customize key and value with something different using
@Freezedand@FreezedUnionValuedecorators.Whereas with the lowercase
@freezedyou cannot customise.So essentially the
@Freezed(...)allows you to customise the value and key.Link to documentation with relevant section highlighted.