### Run Matrix Example Chat Source: https://github.com/famedly/matrix-dart-sdk/blob/main/example/README.md Navigate to the example directory, fetch dependencies, and run the Flutter application. ```sh cd example flutter pub get flutter run ``` -------------------------------- ### Start integration homeserver Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Start a homeserver for integration tests. Supports Conduit, Synapse, and Dendrite. Ensure Docker is running first. ```bash scripts/integration-server-conduit.sh ``` -------------------------------- ### Run database web tests Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Execute database tests in a web environment using the Chrome browser. This requires Chrome to be installed. ```bash dart test test/box_test.dart --platform chrome ``` -------------------------------- ### Basic API Request Example Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/matrix_api_lite/README.md Demonstrates how to initialize the MatrixApi and make a simple request to fetch server capabilities. Ensure the homeserver URI is correctly parsed. ```dart import 'package:matrix/matrix_api_lite.dart'; void main() async { final api = MatrixApi(homeserver: Uri.parse('https://matrix.org')); final capabilities = await api.requestServerCapabilities(); print(capabilities.toJson()); } ``` -------------------------------- ### Configure integration test environment Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Set environment variables for integration tests after starting the homeserver. This includes defining the homeserver address and user credentials. ```bash export HOMESERVER=localhost:80 HOMESERVER_IMPLEMENTATION=conduit source scripts/integration-create-environment-variables.sh scripts/integration-prepare-homeserver.sh ``` -------------------------------- ### Start Direct Message Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Initiates a direct chat with a specified user. Encryption can be optionally disabled by appending `--no-encryption`. ```sh /dm [--no-encryption] ``` -------------------------------- ### Disable Command Parsing Example Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Demonstrates how to send a chat command without enabling command parsing. ```dart Room.sendTextEvent("/command", parseCommands: false); ``` -------------------------------- ### Receive and Process Room Messages Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/get-started.md Load the message timeline for a room and set up callbacks for timeline updates and new message insertions. This example prints fallback message bodies to the console. ```dart // Load the timeline of a room: final timeline = await room.getTimeline( onUpdate: reloadYourGui(), onInsert: (i) => print('New message!'), ); // Print all messages in the timeline to the console for(final event in timeline.events) print(event.calcLocalizedBodyFallback()); ``` -------------------------------- ### Send Emote Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Use this command to send an emote message. For example, `/me is happy` will display as 'YourName is happy'. ```sh /me ``` -------------------------------- ### Start a Poll in Dart Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/msc_extensions/msc_3381_polls/README.md Initiates a new poll in a Matrix room. Ensure to use a unique transaction ID for the answer IDs in production. ```Dart final pollEventId = await room.startPoll( question: 'What do you like more?', kind: PollKind.undisclosed, maxSelections: 2, answers: [ PollAnswer( id: 'pepsi', // You should use `Client.generateUniqueTransactionId()` here mText: 'Pepsi, ), PollAnswer( id: 'coca', mText: 'Coca Cola, ), ]; ); ``` -------------------------------- ### Get Poll Content in Dart Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/msc_extensions/msc_3381_polls/README.md Retrieves the parsed content of a poll event. This should be called after confirming the event is a poll. ```Dart final pollEventContent = event.parsedPollEventContent; ``` -------------------------------- ### Initiate Outgoing Call Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/src/voip/README.md Start a new outgoing voice or video call to a specific user within a room. Listen to call state changes to update the UI and manage the call lifecycle. ```dart final voip = VoIP(client, MyVoipApp()); /// Create a new call final newCall = await voip.inviteToCall(roomId, CallType.kVideo, userId); newCall.onCallStateChanged.stream.listen((state) { /// handle call state change event, /// You can change UI state here, such as Ringing, /// Connecting, Connected, Disconnected, etc. }); /// Then you can pop up the incoming call window at MyVoipApp.handleNewCall. class MyVoipApp implements WebRTCDelegate { ... Future handleNewCall(CallSession session) async { switch(session.direction) { case CallDirection.kOutgoing: // show outgoing call window break; } } ... /// end the call by local newCall.hangup(); ``` -------------------------------- ### Check if an Event is a Poll in Dart Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/msc_extensions/msc_3381_polls/README.md Verifies if a given Matrix event is a poll start event. This check should be performed before any other poll-related actions on the event. ```Dart final isPoll = event.type == PollEventContent.startType; ``` -------------------------------- ### Get Poll Responses in Dart Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/msc_extensions/msc_3381_polls/README.md Retrieves all responses for a given poll from the timeline. It returns a map where keys are user IDs and values are their selected answer IDs. ```Dart final responses = event.getPollResponses(timeline); for(final userId in responses.keys) { print('$userId voted for ${responses[userId]}'); } ``` -------------------------------- ### Prepare vodozemac native library Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Build the vodozemac native library required for E2EE tests. This script clones the dart-vodozemac repository and builds the library. ```bash ./scripts/prepare_vodozemac.sh ``` -------------------------------- ### Initialize Vodozemac for Matrix Client Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/end-to-end-encryption.md Initialize Vodozemac before creating your Matrix Client. This is required for end-to-end encryption. ```dart import 'package:flutter_vodozemac/flutter_vodozemac' as vod; // ... await vod.init(); final client = Client(/*...*/); ``` -------------------------------- ### Initialize Vodozemac with NativeImplementations Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/end-to-end-encryption.md When using NativeImplementations, initialize Vodozemac within the isolate by passing the init function. ```dart final client = Client('Matrix Client', // ... // ... nativeImplementations: NativeImplementationsIsolate( compute, vodozemacInit: () => vod.init(), ), // ... ); ``` -------------------------------- ### Run E2EE integration tests Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Execute the full E2EE integration test suite against a configured homeserver. Requires specific Dart defines for homeserver and user details. ```bash dart --define=HOMESERVER=$HOMESERVER --define=USER1_NAME=$USER1_NAME --define=USER1_PW=$USER1_PW --define=USER2_NAME=$USER2_NAME --define=USER2_PW=$USER2_PW --define=USER3_NAME=$USER3_NAME --define=USER3_PW=$USER3_PW test test_driver/matrixsdk_test.dart -p vm ``` -------------------------------- ### Invite User Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Invites a user to the current room. ```sh /invite ``` -------------------------------- ### Create Matrix Client with In-Memory Database Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/get-started.md Initialize the Matrix client using an in-memory SQLite database. This is suitable for temporary sessions or testing. ```dart import 'package:sqflite_common_ffi/sqflite_ffi.dart'; import 'package:matrix/matrix.dart'; final client = Client( '', database: await MatrixSdkDatabase.init( '', database: await databaseFactoryFfi.openDatabase(':memory:'), sqfliteFactory: databaseFactoryFfi, ), ); ``` -------------------------------- ### Login to Homeserver Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/get-started.md Connect to a Matrix homeserver and authenticate using password-based login. Ensure the homeserver URI is correctly parsed. ```dart // Connect to a homeserver before login: final homeserver = Uri.parse('https://matrix.org'); await client.checkHomeserver(homeserver); await client.login( LoginType.password, user: AuthenticationUserIdentifier(user: ''), password: '', ); ``` -------------------------------- ### Create Matrix Client with Persistent SQFlite Database Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/get-started.md Initialize the Matrix client with a persistent database using SQFlite. Specify the path to the SQLite file for data persistence. ```dart import 'package:sqflite/sqflite.dart'; import 'package:matrix/matrix.dart'; final client = Client( '', database: await MatrixSdkDatabase.init( '', database: await openDatabase('/path/to/database.sqlite'), ), ); ``` -------------------------------- ### Run Matrix Dart SDK tests Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Execute the test suite for the Matrix Dart SDK. Use NO_OLM=1 to skip E2EE tests. The full suite requires the vodozemac native library. ```bash NO_OLM=1 ./scripts/test.sh ``` ```bash ./scripts/test.sh ``` -------------------------------- ### Join Room Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Joins the specified Matrix room. ```sh /join ``` -------------------------------- ### Run single Matrix Dart SDK test file Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Execute a specific test file within the Matrix Dart SDK. Add -x olm to skip encryption-related tests. ```bash dart test test/_test.dart -x olm ``` -------------------------------- ### Initialize OIDC Login Session Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/oidc-login.md Prepare the necessary components for an OIDC login session, including code verifier and state. ```dart final session = await client.initOidcLoginSession( oidcClientData: oidcClientData, redirectUri: Uri.parse('http://localhost:123456'), ); ``` -------------------------------- ### Send HTML Message Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sends a message to the current room as raw HTML. ```sh /html ``` -------------------------------- ### Initialize Crypto Identity with Custom Passphrase Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/end-to-end-encryption.md Initialize the crypto identity with a custom passphrase for added security. ```dart final passphrase = await client.initCryptoIdentity('SuperSecurePassphrase154%'); ``` -------------------------------- ### Send Raw Event Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sends a raw event, formatted as JSON, to the current room. ```sh /sendRaw ``` -------------------------------- ### Build web compatible targets Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Build the web test targets using dart run webdev build. This command is used for web-specific testing scenarios. ```bash dart run webdev build ``` -------------------------------- ### Livekit Backend Configuration Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/src/voip/README.md Specifies the configuration for using the Livekit backend in group calls. This includes the Livekit alias, service URL, and the backend type. ```json "backend": { "livekit_alias": "!qoQQTYnzXOHSdEgqQp:im.staging.famedly.de", "livekit_service_url": "https://famedly-livekit-server.teedee.dev/jwt", "type": "livekit" } ``` -------------------------------- ### Initialize Crypto Identity Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/end-to-end-encryption.md Initialize the crypto identity if it is not already set up. This generates a recovery key. ```dart final recoveryKey = await client.initCryptoIdentity(); ``` -------------------------------- ### Add flutter_vodozemac Package Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/end-to-end-encryption.md Add the flutter_vodozemac package to your Flutter project using the Flutter CLI. ```sh flutter pub add flutter_vodozemac ``` -------------------------------- ### Send Hug Event Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sends a 'hug' event to the current room. ```sh /hug ``` -------------------------------- ### Mark Master Key as Trusted with TOFU Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/trust-on-first-use.md Call `trustOnFirstUse()` on a user's master key to mark it as trusted. This should be done after user confirmation. ```dart final masterKey = client.userDeviceKeys['@userid:domain.abc']?.masterKey; masterKey?.trustOnFirstUse(); ``` -------------------------------- ### Add Matrix Dart SDK and flutter_vodozemac Source: https://github.com/famedly/matrix-dart-sdk/blob/main/README.md Use this command to add the Matrix SDK to your Flutter project. Include flutter_vodozemac for end-to-end encryption support. ```sh flutter pub add matrix # Optional: For end to end encryption: flutter pub add flutter_vodozemac ``` -------------------------------- ### Set User Power Level Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sets the power level for a user in the current room. The default power level is 50. ```sh /op [] ``` -------------------------------- ### Unignore User Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Stops ignoring the specified user, allowing their messages to be seen again. ```sh /unignore ``` -------------------------------- ### Send Cuddle Event Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sends a 'cuddle' event to the current room. ```sh /cuddle ``` -------------------------------- ### Fetch Auth Metadata Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/oidc-login.md Retrieve authentication metadata from a Matrix homeserver that supports the /auth_metadata endpoint. ```dart final (_,_,_,authMetadata) = await client.checkHomserver(Uri.https('matrix.org')); ``` -------------------------------- ### Mesh Backend Configuration Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/src/voip/README.md Defines the configuration for the mesh backend in group calls. This is a simpler configuration, only requiring the backend type to be set to 'mesh'. ```json "backend": { "type": "mesh" } ``` -------------------------------- ### Run Matrix SDK Tests with Concurrency Source: https://github.com/famedly/matrix-dart-sdk/blob/main/README.md Execute tests for the Matrix SDK using Dart's test runner. Adjust thread count for optimal performance. Use flags to filter tests. ```shell thread_count=$(getconf _NPROCESSORS_ONLN) // or your favourite number :3 dart test --concurrency=$thread_count test ``` -------------------------------- ### Kick User Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Removes a user from the current room. ```sh /kick ``` -------------------------------- ### Upgrade Room Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Upgrades the current room to a new version. ```sh /roomupgrade ``` -------------------------------- ### Add Matrix Dart SDK Dependencies Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/get-started.md Include the necessary dependencies in your pubspec.yaml file. For Flutter applications on IO, sqflite or sqflite_ffi is required. For end-to-end encryption, additional dependencies are needed. ```yaml matrix: # (Optional) If you plan to use the SDK in a Flutter application on IO # you need sqflite or sqflite_ffi: sqflite: # (Optional) For end to end encryption, please head on the # encryption guide and add these dependencies: flutter_vodozemac: ``` -------------------------------- ### Set Room Avatar Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sets your avatar in the current room using an MXC URL. ```sh /myroomavatar ``` -------------------------------- ### Check TOFU Timestamp for Master Key Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/trust-on-first-use.md Retrieve the `DateTime` when a master key was last marked as trusted using `trustOnFirstUseSince`. Returns `null` if never trusted. ```dart final tofuSince = masterKey?.trustOnFirstUseSince; // returns a DateTime? ``` -------------------------------- ### Create Group Chat Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Creates a new group chat with an optional name. Encryption can be disabled by appending `--no-encryption`. ```sh /create [] [--no-encryption] ``` -------------------------------- ### Implement WebRTC Delegate for Dart/Flutter Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/src/voip/README.md Adapt platform-specific WebRTC APIs for Dart and Flutter applications. This delegate handles media devices, peer connection creation, and video rendering, and can manage call ringtones. ```dart // for dart app import 'package:dart_webrtc/dart_webrtc.dart' as webrtc_impl; // for flutter app // import 'package:flutter_webrtc/flutter_webrtc.dart' as webrtc_impl; class MyVoipApp implements WebRTCDelegate { @override MediaDevices get mediaDevices => webrtc_impl.navigator.mediaDevices; @override Future createPeerConnection( Map configuration, [Map constraints = const {}]) => webrtc_impl.createPeerConnection(configuration, constraints); @override VideoRenderer createRenderer() => RTCVideoRenderer(); @override Future playRingtone() async { // play ringtone } Future stopRingtone() async { // stop ringtone } Future registerListeners(CallSession session) async { // register all listeners here session.onCallStreamsChanged.stream.listen((CallStateChange event) async {}); session.onCallReplaced.stream.listen((CallStateChange event) async {}); session.onCallHangupNotifierForGroupCalls.stream.listen((CallStateChange event) async {}); session.onCallStateChanged.stream.listen((CallStateChange event) async {}); session.onCallEventChanged.stream.listen((CallStateChange event) async {}); session.onStreamAdd.stream.listen((CallStateChange event) async {}); session.onStreamRemoved.stream.listen((CallStateChange event) async {}); } Future handleNewCall(CallSession session) async { // handle new call incoming or outgoing switch(session.direction) { case CallDirection.kIncoming: // show incoming call window break; case CallDirection.kOutgoing: // show outgoing call window break; } } Future handleCallEnded(CallSession session) async { // handle call ended by local or remote } } ``` -------------------------------- ### Set Room Nickname Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sets your display name within the current room. ```sh /myroomnick ``` -------------------------------- ### Mark Room as Direct Chat Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Marks the current room as a direct chat with the specified user. ```sh /markasdm ``` -------------------------------- ### Register OIDC Client Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/oidc-login.md Dynamically register an OIDC client with the homeserver, specifying redirect URIs and application type. ```dart final oidcClientData = await client.registerOidcClient( redirectUris: [Uri.parse('http://localhost:123456')], applicationType: OidcApplicationType.native, clientInformation: OidcClientInformation(clientUri: Uri.https('my-client-website.com')), ); ``` -------------------------------- ### React to Message Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Adds a reaction to the message you are replying to, using the specified emoji. ```sh /react ``` -------------------------------- ### Logout Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Logs out the current session. ```sh /logout ``` -------------------------------- ### Handle Authentication Redirect and Extract Code Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/oidc-login.md Open a browser for authentication and parse the redirect URL to extract the authorization code and state. ```dart final returnUrlString = await FlutterWebAuth2.authenticate( url: session.authenticationUri.toString(), ); final returnUrl = Uri.parse(returnUrlString); final queryParameters = returnUrl.hasFragment ? Uri.parse(returnUrl.fragment).queryParameters : returnUrl.queryParameters; final code = queryParameters['code'] as String; final state = queryParameters['state'] as String; ``` -------------------------------- ### Create New Room Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/get-started.md Initiate a new direct message (DM) room with a specific user or create a new group chat with a given name. ```dart // Start a new DM room or return an existing room with a user final roomId = await client.startDirectChat(''); // Start a new group chat final roomId = await client.createGroupChat(name: ''); ``` -------------------------------- ### Send Plain Message Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Use this command to send a plain text message to the current room. Commands are not parsed when using this method. ```sh /send ``` -------------------------------- ### Ban User Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Bans a user from the current room, preventing them from rejoining. ```sh /ban ``` -------------------------------- ### Run Dart analyze and format Source: https://github.com/famedly/matrix-dart-sdk/blob/main/AGENTS.md Analyze Dart code for errors and enforce formatting. The format command checks for formatting issues and exits with an error code if changes are needed. ```bash dart analyze dart format --output=none --set-exit-if-changed lib ``` -------------------------------- ### Leave Room Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Leaves the current Matrix room. ```sh /leave ``` -------------------------------- ### Unban User Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Removes a ban on a user, allowing them to rejoin the current room. ```sh /unban ``` -------------------------------- ### Send Plain Text Message Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sends a message as plain text, without any markdown or command parsing, to the current room. ```sh /plain ``` -------------------------------- ### Logout All Sessions Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Logs out all active sessions for the user. ```sh /logoutAll ``` -------------------------------- ### Manual Sign-off Line Source: https://github.com/famedly/matrix-dart-sdk/blob/main/CONTRIBUTING.md The required line to include in your commit or merge request comment to signify agreement with the DCO. Replace 'Your Name' and 'your@email.example.org' with your actual details. ```git Signed-off-by: Your Name ``` -------------------------------- ### Answer or Reject Incoming Call Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/src/voip/README.md Handle incoming calls by displaying an interface with 'answer' and 'reject' options. Use `newCall.answer()` to accept or `newCall.reject()` to decline the call. ```dart ... Future registerListeners(CallSession newCall) async { switch(newCall.direction) { case CallDirection.kIncoming: /// show incoming call window newCall.onCallStateChanged.stream.listen((state) { /// handle call state change event }); break; } } ... /// Answer the call newCall.answer(); // or reject the call newCall.reject(); ``` ```dart To reject a call locally but not send a event, use `newCall.reject(shouldEmit: false)` ``` -------------------------------- ### Ignore User Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Ignores the specified user, so their messages will not be displayed. ```sh /ignore ``` -------------------------------- ### Complete OIDC Login Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/oidc-login.md Finalize the OIDC login process by sending the extracted code and state to the client. ```dart await client.oidcLogin( session: session, code: code, state: state, ); ``` -------------------------------- ### Send Googly Eyes Event Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Sends a 'googly eyes' event to the current room. ```sh /googly ``` -------------------------------- ### Restore Crypto Identity Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/end-to-end-encryption.md Restore a previously initialized crypto identity on a new device using the recovery key or passphrase. ```dart await client.restoreCryptoIdentity(passphraseOrRecoveryKey); ``` -------------------------------- ### Mass Sign-off with Git Rebase Source: https://github.com/famedly/matrix-dart-sdk/blob/main/CONTRIBUTING.md For Git 2.17+, use this command to mass sign off forgotten commits before making a pull request. Ensure you are on the correct branch and rebase against the intended base. ```git git rebase --signoff origin/main ``` -------------------------------- ### Identify Untrusted Users in an Encrypted Room Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/trust-on-first-use.md Iterate through room participants to find users whose master keys are not verified and have not been marked as trusted via TOFU. This check should precede sending messages in encrypted rooms. ```dart Future> getUntrustedUsers(Room room) async { if (!room.encrypted) return []; final users = await room.requestParticipants(); return users.where((user) { if (user.id == room.client.userID) return false; final keys = room.client.userDeviceKeys[user.id]; final masterKey = keys?.masterKey; if (keys == null || masterKey == null || masterKey.verified || masterKey.trustOnFirstUseSince != null) { return false; } return true; }).toList(); } ``` -------------------------------- ### Regenerate Matrix API Lite Code Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/matrix_api_lite/README.md Steps to regenerate the API code using dart_openapi_codegen from the matrix-spec repository. This involves cloning repositories, running a script, and then executing build_runner. ```sh cd dart_openapi_codegen ./scripts/matrix.sh ../matrix-dart-sdk/lib/matrix_api_lite/generated cd .. ``` ```sh cd matrix-dart-sdk dart pub get dart run build_runner build ``` -------------------------------- ### Developer Certificate of Origin Text Source: https://github.com/famedly/matrix-dart-sdk/blob/main/CONTRIBUTING.md The full text of the Developer Certificate of Origin (DCO) that contributors must agree to. This ensures your contributions are intentional and licensed appropriately. ```text Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660 York Street, Suite 102, San Francisco, CA 94110 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` -------------------------------- ### Render Remote Video Stream Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/src/voip/README.md Attach a remote media stream to a video element for rendering. This is typically done within a custom widget that manages the lifecycle of the video display. ```dart class RemoteVideoView extends Widget { VideoElement get videoElement => renderer.element; RTCVideoRenderer get renderer => remoteStream.renderer as RTCVideoRenderer; final WrappedMediaStream remoteStream; RemoteVideoView(this.remoteStream){ renderer.srcObject = remoteStream.mediaStream; } ... @override Element build() { return divElement( children: [ ... videoElement, ... ]); } ... } ``` -------------------------------- ### Discard Outbound Group Session Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Discards the outbound group session for the current room, forcing a new encryption session to be established. ```sh /discardsession ``` -------------------------------- ### Clear Local Cache Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Clears the local cache of the Matrix Dart SDK. ```sh /clearcache ``` -------------------------------- ### Check Crypto Identity State Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/end-to-end-encryption.md Check the current state of the crypto identity to determine if it's initialized and connected. ```dart final state = await client.getCryptoIdentityState(); if (state.initialized) { print('Your crypto identity is initialized. You can either restore or wipe it.'); } if (state.connected) { print('Your crypto identity is initialized and you are connected. You can now only wipe it to reset your passphrase or recovery key!'); } ``` -------------------------------- ### Send Text Message in a Room Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/get-started.md Send a standard text message to a Matrix room. You can retrieve a room by its ID or by the user it's a direct chat with. ```dart // Get a specific room by room ID or iterate over `client.rooms`: final room = client.getRoomById(''); // Or get the DM room for a user: final dmRoom = client.getDirectChatFromUserId(''); // Send a normal text message into the room: await room.sendTextEvent(''); ``` -------------------------------- ### Git Commit with Automatic Sign-off Source: https://github.com/famedly/matrix-dart-sdk/blob/main/CONTRIBUTING.md Use the `-s` flag with `git commit` to automatically add the 'Signed-off-by' line. This uses your configured Git user name and email. ```git git commit -s ``` -------------------------------- ### Respond to a Poll in Dart Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/msc_extensions/msc_3381_polls/README.md Submits a user's vote for a specific poll. The response includes the IDs of the chosen answers. ```Dart final respondeId = await event.answerPoll(['pepsi', 'coca']); ``` -------------------------------- ### Remove Direct Chat Status Command Source: https://github.com/famedly/matrix-dart-sdk/blob/main/doc/commands.md Removes the direct chat status from the current room. ```sh /markasgroup ``` -------------------------------- ### Group Call Membership Event Content Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/src/voip/README.md Defines the structure for the `com.famedly.call.member` event, used to signal active membership in group calls. Ensure all fields are correctly populated, especially `call_id` and `device_id` for proper call routing and identification. ```json "content": { "memberships": [ { "application": "m.call", "backend": { "type": "mesh" }, "call_id": "", "device_id": "YVGPEWNLDD", "expires_ts": 1705152401042, "scope": "m.room", "membershipID": "gor1Gt5BCIlyrxjyHnaEJQ==", } ] } ``` -------------------------------- ### End a Poll in Dart Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/msc_extensions/msc_3381_polls/README.md Closes a poll, preventing further responses. This action should only be performed if the poll has not already ended. ```Dart final endPollId = await event.endPoll(); ``` -------------------------------- ### Check if a Poll Has Ended in Dart Source: https://github.com/famedly/matrix-dart-sdk/blob/main/lib/msc_extensions/msc_3381_polls/README.md Determines if a poll has concluded. This check is necessary before attempting to respond to or end a poll. ```Dart final hasEnded = event.getPollHasBeenEnded(timeline); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.