BackgroundFill.fromJson constructor

BackgroundFill.fromJson(
  1. Map<String, dynamic> json
)

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) {
  return switch (BackgroundFillType.fromJson(json['type'])) {
    BackgroundFillType.solid => BackgroundFillSolid.fromJson(json),
    BackgroundFillType.gradient => BackgroundFillGradient.fromJson(json),
    BackgroundFillType.freeformGradient =>
      BackgroundFillFreeformGradient.fromJson(json),
  };
}