BackgroundFill.fromJson constructor
Creates a new BackgroundFill object. This method decides which BackgroundFill subclass to use based on the type field.
Implementation
factory BackgroundFill.fromJson(Map<String, dynamic> json) {
switch (json['type']) {
case 'solid':
return BackgroundFillSolid.fromJson(json);
case 'gradient':
return BackgroundFillGradient.fromJson(json);
case 'freeform_gradient':
return BackgroundFillFreeformGradient.fromJson(json);
default:
throw ArgumentError('Invalid background fill type');
}
}