isValidJson method

bool isValidJson(
  1. Map<String, dynamic> json
)

Validates that a JSON map has the correct structure for a snapshot.

This is a convenience method for checking if JSON can be deserialized without actually creating a Snapshot instance.

Parameters:

  • json: The JSON map to validate

Returns: true if the JSON is valid, false otherwise.

Implementation

bool isValidJson(Map<String, dynamic> json) {
  try {
    fromJson(json);
    return true;
  } catch (e) {
    return false;
  }
}