Map<String, dynamic> toMap() { return <String, dynamic>{ 'message': message, 'level': level, 'time': time?.millisecondsSinceEpoch, 'error': error, 'stackTrace': stackTrace, }; }