mastodon_dart 0.3.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

mastodon_dart #

The official Dart library for accessing the Mastodon API. Optionally use in conjunction with mastodon_flutter to build a Flutter Mastodon app.

Mastodon API documentation: https://docs.joinmastodon.org/api

Status #

This package is in development. Use in production at your own risk. That said, development is active and most Mastodon features are currently supported.

Mocking #

This library includes a powerful mocking sub-library that lets you quickly build out Mastodon apps using fake data. Once you're ready to use real data, simply switch from the mock library to the real one.

Contributing #

Create an issue, back it with a PR, and tag an active contributor.

Example #

Updated example code coming soon

0.3.2 (4/9/2020) #

0.3.0 (4/9/2020) #

  • Add most missing data entities
  • Add most missing api endpoints
  • Update many data entities with properties that were added in recent versions of Mastodon
  • Move mock library into /src
  • Major documentation upgrades
  • Update Dart SDK constraints
  • 0.3.0+1 address pub health

0.2.2 (4/6/2020) #

  • Improve AuthBloc:
    • Do not await AuthStorage twice in constructor
    • Add logOut function
    • Better docs

0.2.1 (4/4/2020) #

  • Added bookmarks endpoint with corresponding MockBookmarks class
  • Renamed bookmarkStatus to bookmark, unbookmarkStatus to unbookmark to closer match the Mastodon docs.
  • Moved bookmark and unbookmark methods to bookmarks endpoint

0.2.0 (4/2/2020) #

  • Major refactor for AuthBloc
    • Introduce NullInterceptorSink<T> class to ensure that data being added to a sink cannot be null. Update codeSink to use the NullInterceptorSink.
    • Make sure we do not call _handleCode until we have an authenticated application
    • Introduce _initialized Completer, initialized Future, and hasAccount bool check
    • Update _registerApplication with a null check/error throw
    • Update _handleCode to take an AuthenticatedApplication as well as a code
    • Better error handling
    • Updated documentation
  • Removed deprecated example code. Updated code coming soon.

0.1.5 (3/19/2020) #

  • Add missing text property to Status

0.1.4 - 0.1.4+3 (3/18/2020) #

  • Add missing bookmarked property to Status
  • Address pub health suggestions

0.1.3 (3/17/2020) #

  • Add missing attachment type to AttachmentType enum

0.1.2 (3/17/2020) #

  • Add missing parameter to the Notifications endpoint
  • 0.2.1+1: Null coalesce Notification exclude_types

0.1.1+1 (3/16/2020) #

  • Add new NotificationsBloc to handle retrieving Notifications

0.1.0+9 (3/15/2020) #

  • Deprecate flakey auth code validator

0.1.0+7 (3/15/2020) #

  • Update dependencies
  • Update rxdart code for latest version
  • Add formal example project

example/lib/main.dart

import 'dart:io';

import 'package:mastodon_dart/mastodon_dart.dart';
import 'package:web_socket_channel/io.dart';

main() async {
  // Updated example coming soon
}

Use this package as a library

1. Depend on it

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


dependencies:
  mastodon_dart: ^0.3.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:mastodon_dart/mastodon_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

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

  • Dart: 2.8.1
  • pana: 0.13.8-dev

Health suggestions

Fix lib/src/bloc/auth.dart. (-0.50 points)

Analysis of lib/src/bloc/auth.dart reported 1 hint:

line 170 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
async ^2.4.1 2.4.1
http ^0.12.0+4 0.12.1
json_annotation ^3.0.1 3.0.1
rxdart ^0.23.1 0.23.1 0.24.1
web_socket_channel ^1.1.0 1.1.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.5
http_parser 3.1.4
meta 1.1.8
path 1.7.0
pedantic 1.9.0
source_span 1.7.0
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner ^1.8.1
json_serializable ^3.3.0
stack_trace ^1.9.3
test ^1.14.2