create static method

BackgroundType create(
  1. Map<String, dynamic> json
)

Creates a new BackgroundType object. This method decides which BackgroundType subclass to use based on the type field.

Implementation

static BackgroundType create(Map<String, dynamic> json) {
  return switch (BackgroundTypeType.fromJson(json['type'])) {
    BackgroundTypeType.fill => BackgroundTypeFill.fromJson(json),
    BackgroundTypeType.wallpaper => BackgroundTypeWallpaper.fromJson(json),
    BackgroundTypeType.pattern => BackgroundTypePattern.fromJson(json),
    BackgroundTypeType.chatTheme => BackgroundTypeChatTheme.fromJson(json),
  };
}