import 'index.dart'; class MindMapData { final Node root; final String template; final String theme; final String version; late BaseTheme mapTheme; late BaseTemplate mapTemplate; MindMapData(this.root, this.template, this.theme, this.version) { //处理主题 mapTheme = DarkTheme(); mapTemplate = DefaultTemplate(mapTheme); } factory MindMapData.fromJson(Map json) { return MindMapData( Node.fromJson(json['root']), json['template'] ?? 'default', json['theme'] ?? 'fresh-blue', json['version'] ?? '1.0' ); } Map _$MindMapToJson(MindMapData instance) { var map = {}; map['root'] = instance.root.toJson(); map['template'] = instance.template; map['theme'] = instance.theme; map['version'] = instance.version; return map; } Map toJson() => _$MindMapToJson(this); }