LogEntry.fromMap constructor

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

Create a log entry from a map.

Implementation

factory LogEntry.fromMap(Map<String, dynamic> map) {
  return LogEntry(
    timestamp: DateTime.parse(map['timestamp'] as String),
    message: map['message'] as String,
    level: LogLevel.values.firstWhere(
      (l) => l.name == map['level'],
      orElse: () => LogLevel.debug,
    ),
    tag: map['tag'] as String?,
  );
}