matrix_sdk 0.3.0

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

Matrix Dart SDK #

A Dart implementation of the federated communications protocol, Matrix.

Usage #

   var store = SqfliteStore();
   var homeserver = Homeserver(Uri.parse("https://matrix.org"));
   
   var user = await homeserver.login(Username("pit"), "pattle", store: store);
   
   await for (bool success in user.sync()) {
     await for (var 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.

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 hs = Homeserver(Uri.parse("https://matrix.org"));
  final user = await hs.login(Username("joe"), "badPassword");

  await for (bool succes in user.sync()) {
    if (succes) {
      // 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.3.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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.3.0 Apr 18, 2019 Go to the documentation of matrix_sdk 0.3.0 Download matrix_sdk 0.3.0 archive
0.2.4 Apr 16, 2019 Go to the documentation of matrix_sdk 0.2.4 Download matrix_sdk 0.2.4 archive
0.2.3 Apr 16, 2019 Go to the documentation of matrix_sdk 0.2.3 Download matrix_sdk 0.2.3 archive
0.2.2 Apr 13, 2019 Go to the documentation of matrix_sdk 0.2.2 Download matrix_sdk 0.2.2 archive
0.2.1 Apr 10, 2019 Go to the documentation of matrix_sdk 0.2.1 Download matrix_sdk 0.2.1 archive
0.2.0 Apr 10, 2019 Go to the documentation of matrix_sdk 0.2.0 Download matrix_sdk 0.2.0 archive
0.1.9 Apr 7, 2019 Go to the documentation of matrix_sdk 0.1.9 Download matrix_sdk 0.1.9 archive
0.1.8 Apr 7, 2019 Go to the documentation of matrix_sdk 0.1.8 Download matrix_sdk 0.1.8 archive
0.1.7 Apr 5, 2019 Go to the documentation of matrix_sdk 0.1.7 Download matrix_sdk 0.1.7 archive
0.1.6 Apr 5, 2019 Go to the documentation of matrix_sdk 0.1.6 Download matrix_sdk 0.1.6 archive

All 23 versions...

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

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

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

Fix lib/src/api/client.chopper.dart. (-4.41 points)

Analysis of lib/src/api/client.chopper.dart reported 9 hints, including:

line 32 col 8: Don't explicitly initialize variables to null.

line 32 col 53: Don't explicitly initialize variables to null.

line 44 col 8: Don't explicitly initialize variables to null.

line 45 col 7: Don't explicitly initialize variables to null.

line 46 col 7: Don't explicitly initialize variables to null.

Fix lib/src/room/room.dart. (-1.99 points)

Analysis of lib/src/room/room.dart reported 4 hints:

line 24 col 8: Unused import: 'package:matrix_sdk/src/event/room/message_event.dart'.

line 25 col 8: Unused import: 'package:matrix_sdk/src/event/room/room_event.dart'.

line 34 col 8: Unused import: 'package:chopper/chopper.dart'.

line 76 col 12: The parameter 'scope' is required.

Fix lib/src/storables.dart. (-1.49 points)

Analysis of lib/src/storables.dart reported 3 hints:

line 18 col 8: Unused import: 'package:matrix_sdk/src/event/event.dart'.

line 19 col 8: Unused import: 'package:matrix_sdk/src/event/room/message_event.dart'.

line 20 col 8: Unused import: 'package:matrix_sdk/src/event/room/state/state_event.dart'.

Fix additional 19 files with analysis or formatting issues. (-1 points)

Additional issues in the following files:

  • lib/src/api/media.dart (1 hint)
  • lib/src/members.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/events.dart (Run dartfmt to format lib/src/event/events.dart.)
  • lib/src/event/room/message_event.dart (Run dartfmt to format lib/src/event/room/message_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/avatar_change_event.dart (Run dartfmt to format lib/src/event/room/state/avatar_change_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/name_change_event.dart (Run dartfmt to format lib/src/event/room/state/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/homeserver.dart (Run dartfmt to format lib/src/homeserver.dart.)
  • lib/src/identifier.dart (Run dartfmt to format lib/src/identifier.dart.)
  • lib/src/room/rooms.dart (Run dartfmt to format lib/src/room/rooms.dart.)
  • lib/src/store.dart (Run dartfmt to format lib/src/store.dart.)
  • lib/src/user.dart (Run dartfmt to format lib/src/user.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.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
chopper ^2.0.0 2.3.0
http ^0.12.0 0.12.0+2
kiwi ^0.1.0 0.1.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.0.0
dotenv ^1.0.0
pedantic ^1.0.0 1.5.0
test ^1.0.0