fromJson method
Implementation
@override
ImageProvider? fromJson(Map<String, dynamic>? json) {
if (json == null) return null;
switch (json['type']) {
case 'asset':
return AssetImage(
json['assetName'],
package: json['package'],
);
case 'memory':
return MemoryImage(
base64Decode(json['bytes']),
scale: ((json['scale'] ?? 1.0) as num).toDouble(),
);
case 'network':
return NetworkImage(
json['url'],
headers: json['headers'],
scale: ((json['scale'] ?? 1.0) as num).toDouble(),
);
}
throw 'Unsuported_Json_Value';
}