toJson method

  1. @override
Map<String, dynamic> toJson()
override

Used to encode the attributes for this asset file in a corresponding Asset's Contents.json file.

Implementation

@override
Map<String, dynamic> toJson() {
  var json = <String, dynamic>{
    'filename': filename,
    'idiom': idiom,
    'scale': '${scale}x',
    'size': sizeName,
    if (platform != null) 'platform': platform,
    if (appearances != null)
      'appearances': appearances!.map((e) => e.toJson()).toList(),
  };

  if (scale == 0) {
    json.remove('scale');
  }

  return json;
}