fromJson static method

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

Implementation

static ChatNotificationSettings? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return ChatNotificationSettings(
    useDefaultMuteFor: (json['use_default_mute_for'] as bool?) ?? false,
    muteFor: (json['mute_for'] as int?) ?? 0,
    useDefaultSound: (json['use_default_sound'] as bool?) ?? false,
    soundId:
        int.tryParse((json['sound_id'] as dynamic)?.toString() ?? '') ?? 0,
    useDefaultShowPreview:
        (json['use_default_show_preview'] as bool?) ?? false,
    showPreview: (json['show_preview'] as bool?) ?? false,
    useDefaultMuteStories:
        (json['use_default_mute_stories'] as bool?) ?? false,
    muteStories: (json['mute_stories'] as bool?) ?? false,
    useDefaultStorySound: (json['use_default_story_sound'] as bool?) ?? false,
    storySoundId:
        int.tryParse((json['story_sound_id'] as dynamic)?.toString() ?? '') ??
        0,
    useDefaultShowStoryPoster:
        (json['use_default_show_story_poster'] as bool?) ?? false,
    showStoryPoster: (json['show_story_poster'] as bool?) ?? false,
    useDefaultDisablePinnedMessageNotifications:
        (json['use_default_disable_pinned_message_notifications'] as bool?) ??
        false,
    disablePinnedMessageNotifications:
        (json['disable_pinned_message_notifications'] as bool?) ?? false,
    useDefaultDisableMentionNotifications:
        (json['use_default_disable_mention_notifications'] as bool?) ?? false,
    disableMentionNotifications:
        (json['disable_mention_notifications'] as bool?) ?? false,
  );
}