sendImage method

Future<void> sendImage({
  1. required String imageUrl,
  2. String? imageAltText,
})

pass imageUrl as string which also returns Future optional pass imageAltText as string

Implementation

Future<void> sendImage({
  required String imageUrl,
  String? imageAltText,
}) async {
  _assertInstance();

  try {
    var postBody = jsonEncode(
      {
        "blocks": [
          {
            "type": "image",
            "image_url": imageUrl,
            "alt_text": imageAltText,
          }
        ]
      },
    );
    requestUrl(postBody);
  } catch (e) {
    throw SlackLoggerException(e.toString());
  }
}