toMap method

Map<String, dynamic> toMap()

Converts the parameters to a Map for use with the platform channel. This method is for internal use only.

Implementation

Map<String, dynamic> toMap() {
  final Map<String, dynamic> params = {
    'link': Uri.decodeFull(link.toString()),
    'domain': domain,
    'androidBehaviour':
        androidBehaviour == CLDynamicLinkBehaviour.browser ? 1 : 2,
    'iosBehaviour': iosBehaviour == CLDynamicLinkBehaviour.browser ? 1 : 2,
  };

  if (utmSource != null && utmSource!.isNotEmpty) {
    params['utmSource'] = utmSource;
  }
  if (utmMedium != null && utmMedium!.isNotEmpty) {
    params['utmMedium'] = utmMedium;
  }
  if (utmCampaign != null && utmCampaign!.isNotEmpty) {
    params['utmCampaign'] = utmCampaign;
  }
  if (utmContent != null && utmContent!.isNotEmpty) {
    params['utmContent'] = utmContent;
  }
  if (utmTerm != null && utmTerm!.isNotEmpty) {
    params['utmTerm'] = utmTerm;
  }
  if (linkName != null && linkName!.isNotEmpty) {
    params['linkName'] = linkName;
  }
  if (selectedPath != null && selectedPath!.isNotEmpty) {
    params['selectedPath'] = selectedPath;
  }
  if (socialDescription != null && socialDescription!.isNotEmpty) {
    params['socialDescription'] = socialDescription;
  }
  if (socialImageUrl != null && socialImageUrl!.isNotEmpty) {
    params['socialImageUrl'] = socialImageUrl;
  }
  if (socialTitle != null && socialTitle!.isNotEmpty) {
    params['socialTitle'] = socialTitle;
  }

  return params;
}