decodeCanvasScene function

CanvasSceneDocument decodeCanvasScene(
  1. Map<String, Object?> json
)

Decodes current, versioned persisted scene JSON.

Known legacy JSON must be upgraded explicitly before calling this function.

The persistence-format version belongs to the wire format and is removed before constructing the runtime CanvasSceneDocument.

Implementation

CanvasSceneDocument decodeCanvasScene(Map<String, Object?> json) {
  validateCurrentCanvasSceneJson(json);

  final payload = Map<String, dynamic>.from(json)..remove('sceneFormatVersion');

  return CanvasSceneDocument.fromJson(payload);
}