File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -108,18 +108,23 @@ class IconNode extends SceneNode
108108 factory IconNode .fromJson (Map json) {
109109 // backwards compatibility: before properties were added to IconNode.
110110 if (json.containsKey ('icon' ) && ! json.containsKey ('properties' )) {
111+ // Very old model where icon was in IconNode.
111112 json['properties' ] = < String , dynamic > {
112- 'icon' : json['icon' ],
113- 'show' : true ,
114- 'color' : json['color' ],
113+ 'icon' : {
114+ 'icon' : json['icon' ],
115+ 'show' : true ,
116+ 'color' : json['color' ],
117+ },
115118 };
116119 json.remove ('icon' );
117120 }
118- if (json.containsKey ('properties' ) && json['properties' ]['icon' ]['icon' ] == null ) {
121+ if (json.containsKey ('properties' ) &&
122+ json['properties' ]['icon' ]['codepoint' ] != null ) {
119123 // Backwards compatibility for migration to MultiSourceIconModel.
124+ // Old model where properties.icon was IconModel.
120125 json['properties' ]['icon' ] = {
121126 'icon' : {
122- 'icon' : json['properties' ]['icon' ],
127+ 'icon' : json['icon' ] ?? json[ ' properties' ]['icon' ],
123128 'show' : true ,
124129 'color' : json['color' ],
125130 },
You can’t perform that action at this time.
0 commit comments