validate static method

bool validate(
  1. dynamic value, [
  2. String path = 'root'
])

Validates that a value is JSON-serializable and safe for checkpoint.

This method performs a deep validation of the data structure to ensure it can be safely serialized to JSON and restored later.

Parameters:

  • value: The value to validate
  • path: Optional path string for error messages (used recursively)

Throws:

  • StateError if the value contains non-serializable types
  • StateError if the value contains circular references

Returns: true if the value is valid, throws otherwise.

Implementation

static bool validate(dynamic value, [String path = 'root']) =>
    _validateRecursive(value, path, <Object>{});