ProjectState.fromJson constructor
ProjectState.fromJson(
- Map<String, dynamic> json
)
Implementation
factory ProjectState.fromJson(Map<String, dynamic> json) {
List<Map<String, dynamic>> list(String key) =>
((json[key] as List?) ?? const [])
.whereType<Map>()
.map((m) => m.cast<String, dynamic>())
.toList();
return ProjectState(
clips: list('clips').map(VideoEditorClip.fromJson).toList(),
audioTracks:
list('audioTracks').map(VideoEditorAudioTrack.fromJson).toList(),
textOverlays:
list('textOverlays').map(VideoTextOverlay.fromJson).toList(),
effects: list('effects').map(VideoEffectOverlay.fromJson).toList(),
aspectRatio: VideoAspectRatio.values.firstWhere(
(r) => r.name == json['aspectRatio'],
orElse: () => VideoAspectRatio.original,
),
);
}