send method

Future<bool> send()

Use this method to send a message to the slack incoming webhook url that was given by composeMsg method. Instance of SlackBot can be created using the _Message.build method. You can create _Message instances using composeMsg method.

This function will return true if the message was sent successfully and false otherwise.

Implementation

Future<bool> send() async {
  final response = await http.post(
    Uri.parse(_url),
    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
    },
    body: _msg,
  );
  return response.statusCode == 201 || response.statusCode == 200;
}