matrix_sdk 0.13.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 81

Matrix Dart SDK #

A Dart implementation of the federated communications protocol, Matrix.

Usage #

   import 'package:matrix_sdk/matrix_sdk.dart';

   void main() async {
     final sqfliteStore = SqfliteStore();
     final homeserver = Homeserver(Uri.parse('https://pattle.im'));

     final user = await homeserver.login(Username('pat'), 'pattle', store: sqfliteStore);

     await for(SyncState syncState in user.sync()) {
       await for (final room in user.rooms.all()) {
         // Do something
       }
     }
   }

This example uses the SqfliteStore , which is a seperate dependency and only works on Flutter.

Note that using a store is optional.

Contributing #

To contribute, a CLA has to be signed. This is the Fiduciary Contributor License Agreement, a very free software friendly license agreement. It actually guarantees you (the Contributor) that your contributions will never be relicensed to anything other than AGPL version 3 or higher.

To sign the CLA, please send a signed copy to wilko@rens.onl.

An image of your signature is also okay, to do this easily you can edit the HTML version, add a photo of your signature as an <img> tag, render it with pandoc using:

   pandoc cla-signed.html -t html -o cla-signed.pdf --css cla.css

Please note that in the future the signing process will be automated using CLAM.

0.13.2 #

  • Set _directUser based on InviteEvent too
  • Don't serialize width and height if null
  • Add proper toString to MatrixException

0.13.1 #

  • Implement LeftRoom
  • Change Store Room methods to general names (getRooms(..) instead of getJoinedRooms(..), etc.)
  • Set room name to null if set to empty string
  • Remove fromJson(..) factory constructor from Room
  • Remove store param from Room
  • Make all Room parameters named

0.12.3 #

  • Fix remote var being wrong type

0.12.2 #

  • Add original json body to MatrixException
  • Use UnknownException as default MatrixException
  • Handle null room names correctly
  • Fix exception when a Storables has no remote items
  • Handle when width and/or height of ImageInfo are null

0.12.0 #

  • Remove all from parameters

0.11.0 #

Changes from Mathieu Velten:

  • Add allowRemote to option to upTo
  • Add to parameter to upTo
  • Remove from from upTo
  • Add AudioMessageEvent

0.10.1 #

  • Add rooms.create method
  • Remove integration tests These will be replaced with proper unit tests in the future.

0.10.0 #

  • Rename AvatarUrlChangeEvent to AvatarChangeEvent
  • Rename AvatarChangeEvent to RoomAvatarChangeEvent
  • Rename NameChangeEvent to RoomNameChangeEvent
  • Add RoomCreationEvent
  • members.get() returns oldest user state if the given time (at) is lower than any known state.
  • Fix state not being processed properly if room was newly created. Now all processing of events is done in a single function.

0.9.0 #

  • Replace subjectId of MemberChangeEvents with subject, a User containing the state at the time of the event
  • Fix wrong id being used when adding user state
  • Fix exception when image dimensions are doubles

0.8.2 #

  • Fix emote messages being the fallback message

0.8.1 #

  • Implement m.emote

0.8.0 #

  • Relicense to AGPL
  • Remove SyncFailReason
  • Remove dependency on dart:io
  • Add members from state processing
  • Update README

0.7.2 #

  • Complete relicense to LGPL
  • Save membership in prev_content of DisplayNameChangeEvent and AvatarUrlChangeEvent

0.7.1 #

  • Relicense under LGPL
  • Move storing remote items logic

Changes by Mathieu Velten:

  • Implement long polling and exponential back off for sync
  • Optimize removing local echo events
  • Fix instance where context could not be null

0.7.0 #

  • Rename events to timeline
  • Save events retrieved from messages endpoint
  • Change return types to RoomEvent
  • Add null check for context
  • Use FutureOr more
  • Let User extends Identifiable

Changes from Mathieu Velten (thank you!)

  • Split sync between sync and syncOnce
  • Add filter and timeout support
  • Implement setPusher
  • Add support for custom key-value data at the app level on Identifiables

0.6.0 #

  • Keep track of user state changes

0.5.8 #

  • Add DisplayNameChangeEvent and AvatarUrlChangeEvent
  • Check if the user id is valid when processing direct chats

0.5.7 #

  • Sort items from memory in all() call

0.5.6 #

  • Implement redactions

0.5.5 #

  • Leave user name null if unset

0.5.4 #

  • Add avatarUrl field to User
  • Make membershipType protected

0.5.3 #

  • Add directUser to JoinedRoom constructor

0.5.2 #

  • Implement m.direct

0.5.1 #

  • Set room name to null if name is an empty string

0.5.0 #

  • Let room name be null if unset

0.4.12 #

  • Serialize replies

0.4.11 #

  • Add inReplyToId field to MessageEventContent

0.4.10 #

  • Add transaction_id param to send
  • Serialize transaction_id
  • Use RoomEventArgs in Event.fromJson

0.4.9 #

  • Pass sentState to args
  • Await sending

0.4.8 #

  • Add RoomEventArgs and rename SentState.waiting

0.4.7 #

  • Add getUnsentEvents method to Store
  • Retry sending if failed

0.4.6 #

  • Get display name from prev_content as backup

0.4.5 #

  • Fix leave events not having a display name set

0.4.4 #

  • Pass a SyncState object in the sync stream

0.4.3 #

  • Add downloadThumbnail method

0.4.2 #

  • Fix sending test
  • Add formattedBody field to TextMessageEvent
  • Fix store required being non-null

0.4.1 #

  • Serialize display name of member change event

0.4.0 #

  • Implement local message echo

0.3.9 #

  • Serialize url and image info properly

0.3.8 #

  • Fix url not being serialized of image message

0.3.7 #

  • Add image information to image message event

0.3.6 #

  • Return null if image url is null

0.3.5 #

  • Implement m.image message event

0.3.2 #

  • Add delete() method to Store

0.3.1 #

  • Add ability to logout

0.3.0 #

  • Implement message sending
  • Move content fields to seperate classes

0.2.4 #

  • Don't pass dependency injection scope seperately
  • Don't silence dependency injection errors
  • Fix events sometimes being null

0.2.3 #

  • Implement fetching events from history
  • Use dependency injection (using Kiwi)
  • Simplify user assignment when creating events
  • Don't sort items when adding them
  • Implement upTo(count) method in Storables

0.2.2 #

  • Fix exception when handling avatar deletion

0.2.1 #

  • Add option to set user when creating event
  • Let display names also be set on subsequent syncs

0.2.0 #

  • Add Room and User reference to events
  • Save more efficiently
  • Remove print when using historical localpart
  • Add fullState param to sync api
  • Implement members
  • Change some field names
  • Add null checks to LocalUser.fromStore()

0.1.9 #

  • Remove idb_shim dependency
  • Make Rooms and Events implementation generic
  • Deserialize other member events, add displayname
  • Restructure event classes
  • Implement m.room.member
  • Fix events.state() returning MessageEvent stream

0.1.8 #

  • Cast specific event streams
  • Use room id as name if room name is null

0.1.7 #

  • Add avatar url to JoinedRoom constructor

0.1.6 #

  • Fix AvatarChangeEvent not being able to serialize

0.1.5 #

  • Implement m.room.avatar event
  • Add media download method

0.1.4 #

  • Add LocalUser.fromStore
  • Add ability to store homeserver and user id

0.1.3 #

  • Don't check whether Store is open in LocalUser constructor

0.1.2 #

  • Make Store per user
  • Remove IndexedDbStore

0.1.1 #

  • Export event(s)

0.1.0 #

  • Add basic event support
  • Use IndexedDB instead of Sembast store
  • Let store support multiple LocalUsers
  • Fix equality issues
  • Restructure tests, use a test room on matrix.org
  • Use dotenv for username and password in tests

0.0.7 #

  • Fix bug where sync would continously add duplicate rooms

0.0.6 #

  • Fix sync always being initial sync

0.0.5 #

  • Depend on a lower version of the meta package

0.0.4 #

  • Fix syncing without store throwing exception
  • Add missing meta dependency
  • Add example code
  • Remove unused imports

example/main.dart

import 'package:matrix_sdk/matrix_sdk.dart';

void main() async {
  final homeserver = Homeserver(Uri.parse('https://pattle.im'));

  final user = await homeserver.login(Username('pat'), 'pattle');

  await for(SyncState syncState in user.sync()) {
    await for (final room in user.rooms.all()) {
      // Do something
    }
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  matrix_sdk: ^0.13.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:matrix_sdk/matrix_sdk.dart';
  
Version Uploaded Documentation Archive
0.13.2 Jun 18, 2019 Go to the documentation of matrix_sdk 0.13.2 Download matrix_sdk 0.13.2 archive
0.13.1 Jun 15, 2019 Go to the documentation of matrix_sdk 0.13.1 Download matrix_sdk 0.13.1 archive
0.13.0 Jun 15, 2019 Go to the documentation of matrix_sdk 0.13.0 Download matrix_sdk 0.13.0 archive
0.12.3 Jun 14, 2019 Go to the documentation of matrix_sdk 0.12.3 Download matrix_sdk 0.12.3 archive
0.12.2 Jun 14, 2019 Go to the documentation of matrix_sdk 0.12.2 Download matrix_sdk 0.12.2 archive
0.12.0 Jun 13, 2019 Go to the documentation of matrix_sdk 0.12.0 Download matrix_sdk 0.12.0 archive
0.11.0 Jun 13, 2019 Go to the documentation of matrix_sdk 0.11.0 Download matrix_sdk 0.11.0 archive
0.10.1 Jun 13, 2019 Go to the documentation of matrix_sdk 0.10.1 Download matrix_sdk 0.10.1 archive
0.10.0 Jun 9, 2019 Go to the documentation of matrix_sdk 0.10.0 Download matrix_sdk 0.10.0 archive
0.9.0 Jun 9, 2019 Go to the documentation of matrix_sdk 0.9.0 Download matrix_sdk 0.9.0 archive

All 71 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
68
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
81
Learn more about scoring.

We analyzed this package on Jun 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:matrix_sdk/matrix_sdk.dart.

Health suggestions

Fix lib/src/user.dart. (-1 points)

Analysis of lib/src/user.dart reported 2 hints:

line 166 col 7: The parameter 'state' is required.

line 186 col 28: The value of the local variable 'sentState' isn't used.

Fix lib/src/api/media.dart. (-0.50 points)

Analysis of lib/src/api/media.dart reported 1 hint:

line 20 col 8: Unused import: 'package:meta/meta.dart'.

Fix lib/src/event/room/state/room_creation_event.dart. (-0.50 points)

Analysis of lib/src/event/room/state/room_creation_event.dart reported 1 hint:

line 23 col 8: Unused import: '../../../user.dart'.

Fix additional 21 files with analysis or formatting issues. (-0.50 points)

Additional issues in the following files:

  • lib/src/room/room.dart (1 hint)
  • lib/src/api/access_token_interceptor.dart (Run dartfmt to format lib/src/api/access_token_interceptor.dart.)
  • lib/src/api/client.dart (Run dartfmt to format lib/src/api/client.dart.)
  • lib/src/event/event.dart (Run dartfmt to format lib/src/event/event.dart.)
  • lib/src/event/room/message_event.dart (Run dartfmt to format lib/src/event/room/message_event.dart.)
  • lib/src/event/room/redaction_event.dart (Run dartfmt to format lib/src/event/room/redaction_event.dart.)
  • lib/src/event/room/room_event.dart (Run dartfmt to format lib/src/event/room/room_event.dart.)
  • lib/src/event/room/state/member_change_event.dart (Run dartfmt to format lib/src/event/room/state/member_change_event.dart.)
  • lib/src/event/room/state/room_avatar_change_event.dart (Run dartfmt to format lib/src/event/room/state/room_avatar_change_event.dart.)
  • lib/src/event/room/state/room_name_change_event.dart (Run dartfmt to format lib/src/event/room/state/room_name_change_event.dart.)
  • lib/src/event/room/state/state_event.dart (Run dartfmt to format lib/src/event/room/state/state_event.dart.)
  • lib/src/event/timeline.dart (Run dartfmt to format lib/src/event/timeline.dart.)
  • lib/src/exception.dart (Run dartfmt to format lib/src/exception.dart.)
  • lib/src/homeserver.dart (Run dartfmt to format lib/src/homeserver.dart.)
  • lib/src/identifier.dart (Run dartfmt to format lib/src/identifier.dart.)
  • lib/src/members.dart (Run dartfmt to format lib/src/members.dart.)
  • lib/src/room/rooms.dart (Run dartfmt to format lib/src/room/rooms.dart.)
  • lib/src/storables.dart (Run dartfmt to format lib/src/storables.dart.)
  • lib/src/store.dart (Run dartfmt to format lib/src/store.dart.)
  • lib/src/util/chopper.dart (Run dartfmt to format lib/src/util/chopper.dart.)
  • lib/src/util/random.dart (Run dartfmt to format lib/src/util/random.dart.)

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 (1 direct: kiwi).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
chopper ^2.3.1 2.4.1
http ^0.12.0 0.12.0+2
kiwi ^0.1.0 0.1.0 0.2.0
meta ^1.1.6 1.1.7
validators ^2.0.0 2.0.0+1
Transitive dependencies
async 2.2.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
logging 0.11.3+2
path 1.6.2
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner ^1.0.0
chopper_generator ^2.3.3
dotenv ^1.0.0
pedantic ^1.0.0 1.7.0
test ^1.0.0