AvailableFeatures.fromJson constructor

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

Creates an AvailableFeatures instance from a JSON map.

This factory constructor parses a JSON map and creates an AvailableFeatures instance. It uses platform-specific logic to accommodate differences in JSON structure between iOS and Android.

json: The JSON map to parse.

Implementation

factory AvailableFeatures.fromJson(Map<String, dynamic> json) =>
    AvailableFeatures(
      isLocationAttachmentAvailable: Platform.isIOS
          ? json["locationAttachment"]
          : json["isLocationAttachmentEnabled"],
      isClearChatAvailable:
          Platform.isIOS ? json["clearChat"] : json["isClearChatEnabled"],
      isDeleteChatAvailable:
          Platform.isIOS ? json["deleteChat"] : json["isDeleteChatEnabled"],
      isVideoAttachmentAvailable: Platform.isIOS
          ? json["videoAttachment"]
          : json["isVideoAttachmentEnabled"],
      isOneToOneCallAvailable: Platform.isIOS
          ? json["one2oneCall"]
          : json["isOneToOneCallEnabled"],
      isTranslationAvailable:
          Platform.isIOS ? json["translation"] : json["isTranslationEnabled"],
      isViewAllMediaAvailable: Platform.isIOS
          ? json["viewAllMedias"]
          : json["isViewAllMediaEnabled"],
      isDocumentAttachmentAvailable: Platform.isIOS
          ? json["documentAttachment"]
          : json["isDocumentAttachmentEnabled"],
      isGroupCallAvailable:
          Platform.isIOS ? json["groupCall"] : json["isGroupCallEnabled"],
      isRecentChatSearchAvailable: Platform.isIOS
          ? json["recentchatSearch"]
          : json["isRecentChatSearchEnabled"],
      isImageAttachmentAvailable: Platform.isIOS
          ? json["imageAttachment"]
          : json["isImageAttachmentEnabled"],
      isGroupChatAvailable:
          Platform.isIOS ? json["groupChat"] : json["isGroupChatEnabled"],
      isContactAttachmentAvailable: Platform.isIOS
          ? json["contactAttachment"]
          : json["isContactAttachmentEnabled"],
      isStarMessageAvailable:
          Platform.isIOS ? json["starMessage"] : json["isStarMessageEnabled"],
      isAttachmentAvailable:
          Platform.isIOS ? json["attachment"] : json["isAttachmentEnabled"],
      isAudioAttachmentAvailable: Platform.isIOS
          ? json["audioAttachment"]
          : json["isAudioAttachmentEnabled"],
      isBlockAvailable:
          Platform.isIOS ? json["block"] : json["isBlockEnabled"],
      isReportAvailable:
          Platform.isIOS ? json["report"] : json["isReportEnabled"],
      isDeleteMessageAvailable: Platform.isIOS
          ? json["deleteMessage"]
          : json["isDeleteMessageEnabled"],
      isChatHistoryAvailable:
          Platform.isIOS ? json["chatHistory"] : json["isChatHistoryEnabled"],
    );