- By using [package:image](https://pub.dev/packages/image), the `MatrixImageFile` was given automatically generated width and heigth. - Moreover, `MatrixImageFile` was given a factory to create the image file from a given maximal dimension. - When sending images without explicitly providing a thumbnail, the thumbnail is automatically generated based on the provided image. - The blur hash in generated automatically based on the provided image. Fixes: https://gitlab.com/famedly/company/frontend/famedly-web/-/issues/162, https://gitlab.com/famedly/fluffychat/-/issues/756 Signed-off-by: Lanna Michalke <l.michalke@famedly.com> |
||
|---|---|---|
| .gitlab | ||
| example | ||
| home | ||
| lib | ||
| scripts | ||
| test | ||
| test_driver | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .metadata | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| README.md | ||
| analysis_options.yaml | ||
| build.yaml | ||
| pubspec.yaml | ||
README.md
Matrix SDK
Matrix (matrix.org) 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
- Import the sdk
matrix: <latest-version>
# Optional:
flutter_olm: <latest-version>
flutter_openssl_crypto: <latest-version>
import 'package:matrix/matrix.dart';
- 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(
"HappyChat",
databaseBuilder: (Client client) async {
await Hive.init('/path/to/your/storage');
final db = FamedlySdkHiveDatabase(client.clientName);
await db.open();
return db;
},
);
- Connect to a Matrix Homeserver and listen to the streams:
client.onLoginStateChanged.stream.listen((bool loginState){
print("LoginState: ${loginState.toString()}");
});
client.onEvent.stream.listen((EventUpdate eventUpdate){
print("New event update!");
});
client.onRoomUpdate.stream.listen((RoomUpdate eventUpdate){
print("New room update!");
});
await client.checkHomeserver("https://yourhomeserver.abc");
await client.login(
identifier: AuthenticationUserIdentifier(user: 'alice'),
password: '123456',
);
- Send a message to a Room:
await client.getRoomById('your_room_id').sendTextEvent('Hello world');