InboxMessageCard constructor
InboxMessageCard({
- Key? key,
- required String title,
- required String body,
- String? receivedLabel,
- bool isRead = false,
- bool isClaimed = false,
- List<
InboxAttachment> attachments = const [], - DateTime? expiresAt,
- VoidCallback? onOpen,
- VoidCallback? onClaim,
- String claimLabel = 'Claim',
- String? semanticLabel,
- DateTime clock()?,
Implementation
InboxMessageCard({
super.key,
required this.title,
required this.body,
this.receivedLabel,
this.isRead = false,
this.isClaimed = false,
this.attachments = const [],
this.expiresAt,
this.onOpen,
this.onClaim,
this.claimLabel = 'Claim',
this.semanticLabel,
DateTime Function()? clock,
}) : clock = clock ?? DateTime.now {
if (title.trim().isEmpty) {
throw ArgumentError.value(title, 'title', 'must not be empty');
}
if (body.trim().isEmpty) {
throw ArgumentError.value(body, 'body', 'must not be empty');
}
if (claimLabel.trim().isEmpty) {
throw ArgumentError.value(claimLabel, 'claimLabel', 'must not be empty');
}
for (final a in attachments) {
if (a.amount < 0) {
throw ArgumentError.value(
a.amount,
'attachments',
'amount must be non-negative',
);
}
}
}