slack 2.0.0

dart-slack #

Dartlang interface to the Slack Webhook API

API Documentation available on Pub

Simple Start #

import 'package:slack/html/slack';
// or 
import 'package:slack/io/slack';

main() {
  Slack slack = new Slack('webhook-url');
  Message message = new Message('foo message',username:'bar-user');      

Attachment Support #

Minimally attachments require a 'fallback' [String], in the first field.

Attachment bugReport = new Attachment("I can't use Slack!",
   pretext: 'A Critical Bug Reported',
   text   : "I can't use Slack!",
   color  : 'danger');

Message message = new Message('Bug Report:', username: 'bugBot', attachments: [bugReport]);

Cascades #

Messages, Attachments, and Fields are mostly just data containers. This means that you have a choice between setting their values in the constructor or setting them in a cascade. For example, Attachments could be defined like so:

Attachment bugReport = new Attachment("I can't use Slack!")
   ..pretext = 'A Critical Bug Reported'
   ..text   = "I can't use Slack!"
   ..color  = 'danger';

Message message = new Message('Bug Report:')
    ..username    = 'bugBot'
    ..attachments = [bugReport];

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  slack: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:slack/html/slack.dart';
import 'package:slack/io/slack.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/src/slacksrc.dart. (-2.48 points)

Analysis of lib/src/slacksrc.dart reported 5 hints:

line 32 col 19: Unnecessary new keyword.

line 46 col 41: DO use curly braces for all flow control structures.

line 90 col 22: Unnecessary new keyword.

line 102 col 31: DO use curly braces for all flow control structures.

line 128 col 17: Unnecessary new keyword.

Fix lib/io/slack.dart. (-1 points)

Analysis of lib/io/slack.dart reported 2 hints:

line 3 col 8: Unused import: 'dart:async'.

line 4 col 8: Unused import: 'dart:io'.

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Provide a file named (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (http).

Package is getting outdated. (-16.99 points)

The package was last published 61 weeks ago.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and slack.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.

The package description is too short. (-2 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http ^0.11.2 0.11.3+17 0.12.0+4
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.12
http_parser 3.1.4
meta 1.1.8
path 1.6.4
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6