TrustPinLogEvent.fromMap constructor

TrustPinLogEvent.fromMap(
  1. Map<Object?, Object?> map
)

Decodes an event map received from the platform event channel.

Implementation

factory TrustPinLogEvent.fromMap(Map<Object?, Object?> map) {
  final level = switch (map['level'] as String?) {
    'error' => TrustPinLogLevel.error,
    'debug' => TrustPinLogLevel.debug,
    _ => TrustPinLogLevel.info,
  };
  return TrustPinLogEvent(
    level: level,
    instanceId: map['instanceId'] as String? ?? 'default',
    message: map['message'] as String? ?? '',
  );
}