FLUTTER ECOSYSTEM

slimpotatoboy/slack_logger

一个简单的 Flutter 包,通过 Slack Webhook 将消息发送到 Slack 频道

slack_logger 项目封面
Stars
8
Forks
3
最近推送(UTC)
2024年9月26日
项目状态
未归档
Dipen GitHub avatar
GITHUB User

Dipen ↗

Developer

Australia
语言Dart

技术话题

此仓库发布的插件

使用的依赖

依赖清单 4 项
  • flutter{"sdk":"flutter"}
  • http^1.1.0
  • flutter_test开发依赖{"sdk":"flutter"}
  • flutter_lints开发依赖>=2.0.0 <5.0.0

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

Slack Logger 🚀

GitHub stars

Follow Twitter

A simple Flutter package to send message to slack channel via slack webhook

Usage

To use this plugin, add slack_logger as a dependency in your pubspec.yaml file 🔗.

Steps before using this package
  • Add Apps to 🔗 https://api.slack.com/apps/.

  • Go to Incoming Webhook Link and Enable it.

  • Create your slack channel.

  • Create new webhook and link slack channel.

You are good to go now 👍
Initialize [SlackLogger]
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {

    SlackLogger(webhookUrl: "[Add Your Web Hook Url]");

    return MaterialApp(
      ...
    );
  }
}
Create Instance of SlackLogger
final slack = SlackLogger.instance;
Send Message:
...

slack.send("This is a error log to my channel");

...
Send Image:
...

slack.sendImage(
  imageUrl: "[image url]",
  imageAltText: "[alt text for image]",
);

...
Send Image With Text Block:
...

slack.sendImageWithText(
  text: "[text]",
  imageUrl: "[image url]",
  imageAltText: "[alt text for image]"
);

...
Send Text (Markdown) with Button:
...

slack.sendTextWithButton(
  markdownMessage: "[markdown message]",
  buttonLabel: "[button label]",
  url: "[button link]"
);

...
Send Text As Attachments:
...

slack.sendTextAsAttachment(
  message:"[Your Message]",
  color: "[color]"
);

...
Send Markdowns As Attachments:
...

slack.sendMarkdownAsAttachment(
  markdownMessageList: List<String> [markdownMessageList],
  color: "[color]"
);

...

🚀 Contributors


Any new Contributors are welcomed.

Feel Free to request any missing features or report issues here 🔗.