fromMap static method

WalletCreatedEvent fromMap(
  1. Map<String, dynamic> map
)

Create event from a map during deserialization This is a factory method that should be implemented by concrete event classes

Implementation

static WalletCreatedEvent fromMap(Map<String, dynamic> map) {
  return WalletCreatedEvent(
    walletId: map['walletId'] as String,
    walletName: map['walletName'] as String,
    rootAddress: map['rootAddress'] as String,
    walletType: WalletTypeExtension.fromStorageString(
      map['walletType'] as String? ?? 'hd', // Default to HD for backwards compatibility
    ),
    walletMetadata: map['walletMetadata'] as Map<String, dynamic>?,
    // Rows written before KM-8 carry the xpub. Keep it readable in memory
    // (nothing read from the journal is dropped); toMap never writes it.
    // ignore: deprecated_member_use_from_same_package
    hdPublicKeyXpub: map['hdPublicKeyXpub'] as String?,
    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>?,
  );
}