fromMap static method
Create event from a map during deserialization This is a factory method that should be implemented by concrete event classes
Implementation
static InvoiceCreatedEvent fromMap(Map<String, dynamic> map) {
return InvoiceCreatedEvent(
invoiceId: map['invoiceId'] as String,
walletId: map['walletId'] as String,
addresses: List<String>.from(map['addresses']),
amount: BigInt.parse(map['amount'] as String),
outputs: map['outputs'] != null
? (map['outputs'] as List)
.map((o) => InvoiceOutputSpec.fromMap(o as Map<String, dynamic>))
.toList()
: null,
description: map['description'] as String?,
expiresAt: map['expiresAt'] != null
? (map['expiresAt'] is String
? DateTime.parse(map['expiresAt'] as String)
: map['expiresAt'] as DateTime)
: null,
invoiceMetadata: map['invoiceMetadata'] as Map<String, dynamic>?,
eventId: map['eventId'] as String?,
timestamp: map['timestamp'] != null
? (map['timestamp'] is String
? DateTime.parse(map['timestamp'] as String)
: map['timestamp'] as DateTime)
: null,
version: map['version'] as int?,
metadata: map['metadata'] as Map<String, dynamic>?,
);
}