fromJson static method

SimpleOverlayLog fromJson(
  1. Map<String, dynamic> json
)

Creates a SimpleOverlayLog instance from a JSON map.

This is the inverse of toJson() and is typically used when deserializing log entries from storage. The input map should contain all fields returned by toJson().

Parameters:

  • json: A map containing the serialized log data

Returns: A new SimpleOverlayLog instance with the deserialized data

Throws:

  • FormatException: If the timestamp is not in ISO 8601 format
  • ArgumentError: If the level is not a valid LogLevel name

Implementation

static SimpleOverlayLog fromJson(Map<String, dynamic> json) =>
    SimpleOverlayLog(
      timestamp: DateTime.parse(json['timestamp'] as String),
      tag: json['tag'] as String,
      message: json['message'] as String,
      level: LogLevel.values.byName(json['level'] as String),
    );