Files
m8chat-app2/lib/core/network/matrix_client.dart
help4bis 8f13c725a4 feat: Phase 1 complete — Matrix login, rooms, chat, profile
- Direct m.login.password auth against matrix.m8chat.au
- Room list with unread badges, last message, timestamps
- Chat timeline (text, images, files, replies, reactions)
- Profile screen with expandable Notifications and Security sections
- Olm E2EE initialisation (web WASM bootstrap)
- Global error handler preventing Matrix SDK crashes
- GoRouter with refreshListenable (no recreation on auth change)
- Feature-first clean architecture: Riverpod + GoRouter + Drift
- Deployed to https://app2.m8chat.au

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 06:26:57 +10:00

23 lines
787 B
Dart

// Version: 1.0.1 | Created: 2026-04-01
// Matrix SDK client singleton provider.
// The Matrix client is kept alive for the full app lifetime once initialised.
import 'package:matrix/matrix.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import '../config/app_config.dart';
part 'matrix_client.g.dart';
/// Provides the single [Client] instance used throughout the app.
///
/// keepAlive: true — the Matrix client must never be disposed while the app
/// is running; it holds the sync loop and all room state.
///
/// Phase 1: no databaseBuilder — uses in-memory store only (no persistence
/// across restarts). Phase 2 will wire in a drift-backed DatabaseApi.
@Riverpod(keepAlive: true)
Client matrixClient(Ref ref) {
return Client(AppConfig.appName);
}