DartBlockEnvironment.fromJson constructor

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

NOTE: The serialized form intentionally omits the upward parent link to avoid infinite recursion (child -> parent -> child ...) during JSON (de)serialization. We call the generated _$DartBlockEnvironmentFromJson to deserialize children (downward links) and then restore parent references in-memory via _rebuildParentReferences().

This keeps the JSON acyclic and prevents stack overflows while preserving parent pointers after deserialization.

Implementation

factory DartBlockEnvironment.fromJson(Map<String, dynamic> json) =>
    // Use generated deserializer then re-establish parent links for children
    (() {
      final env = _$DartBlockEnvironmentFromJson(json);
      env._rebuildParentReferences();
      return env;
    })();