I have a model who have "date" as a final parameter .
class WalletTransaction extends Equatable {
final String id;
final String amount;
final String description;
final bool isDepense;
final Timestamp date;
WalletTransaction(
{required this.id,
required this.date,
required this.amount,
required this.isDepense,
required this.description});
I want to pass an instance of this model class so i did a null check operator to check if the variables is null or not
AddWalletTransactions(
new WalletTransaction(
amount: amount ?? "00",
date: date ?? Timestamp.fromDate(DateTime.now()),
isDepense: isDepense ?? true,
description: description ?? "",
)
)
But the it gives me this problem in Timestamp.fromDate(DateTime.now()) :
The argument type 'Object' can't be assigned to the parameter type 'Timestamp'.