getApplicationAsset method

String? getApplicationAsset({
  1. required String applicationId,
  2. required String applicationAssetHash,
  3. DiscordImageFormat format = DiscordImageFormat.png,
  4. int size = 128,
})

Tries to create the right URL slug for an application asset, given its application_id and asset hash, in a given format (defaults to PNG), with a given size (defaults to 128).

Returns null if the format is not available or the size is not valid.

Implementation

String? getApplicationAsset({
  required String applicationId,
  required String applicationAssetHash,
  DiscordImageFormat format = DiscordImageFormat.png,
  int size = 128,
}) {
  if (!formatList2.contains(format) || !isValidSize(size)) {
    return null;
  }
  return getString(
    '/app-assets/$applicationId/$applicationAssetHash.${format.fileExtension}?size=$size',
  );
}