如果Strig? id
是null
,我想为它分配一个uuid
或随机int
(作为字符串)。
@freezed
class Todo with _$Todo {
const factory Todo({
@Default(false) bool isComplete,
String? id,
required String title,
required String todo,
}) = _Todo; ```
In vanila Constructor, I could to it in Initializer list.