InboxMessageCard constructor

InboxMessageCard({
  1. Key? key,
  2. required String title,
  3. required String body,
  4. String? receivedLabel,
  5. bool isRead = false,
  6. bool isClaimed = false,
  7. List<InboxAttachment> attachments = const [],
  8. DateTime? expiresAt,
  9. VoidCallback? onOpen,
  10. VoidCallback? onClaim,
  11. String claimLabel = 'Claim',
  12. String? semanticLabel,
  13. 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',
      );
    }
  }
}