FigmaVariableCollection.fromJson constructor

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

Creates a FigmaVariableCollection from a JSON map.

The JSON structure should match Figma's API response format for variable collections. Throws if required fields are missing or of incorrect type.

Implementation

factory FigmaVariableCollection.fromJson(Map<String, dynamic> json) {
  return FigmaVariableCollection(
    id: json['id'] as String,
    name: json['name'] as String,
    modes: (json['modes'] as List)
        .map((mode) => FigmaVariableMode.fromJson(mode))
        .toList(),
    variableIds: (json['variableIds'] as List).cast<String>(),
    defaultModeId: json['defaultModeId'] as String,
  );
}