matrix 0.11.1 icon indicating copy to clipboard operation
matrix: ^0.11.1 copied to clipboard

Matrix Dart SDK

Matrix SDK #

Matrix ( SDK written in dart.

Native libraries #

For E2EE, libolm must be provided.

Additionally, OpenSSL (libcrypto) must be provided on native platforms for E2EE.

For flutter apps you can easily import it with the flutter_olm and the flutter_openssl_crypto packages.

How to use this #

  1. Import the sdk
  matrix: <latest-version>
  # Optional:
  flutter_olm: <latest-version>
  flutter_openssl_crypto: <latest-version>
import 'package:matrix/matrix.dart';
  1. Create a new client:
final client = Client("HappyChat");

The SDK works better with a database. Otherwise it has no persistence. For this you need to provide a databaseBuilder like this:

final client = Client(
  databaseBuilder: (Client client) async {
    await Hive.init('/path/to/your/storage');
    final db = FamedlySdkHiveDatabase(client.clientName);
    return db;
  1. Connect to a Matrix Homeserver and listen to the streams: loginState){ 
  print("LoginState: ${loginState.toString()}");
}); eventUpdate){ 
  print("New event update!");
}); eventUpdate){ 
  print("New room update!");

await client.checkHomeserver("");
await client.login(
  identifier: AuthenticationUserIdentifier(user: 'alice'),
  password: '123456',
  1. Send a message to a Room:
await client.getRoomById('your_room_id').sendTextEvent('Hello world');