import 'package:flutter/material.dart'; import 'package:matrix/matrix.dart'; class ZenithClientProvider extends ChangeNotifier { late Client _client; bool _loading = true; Client get client => _client; bool get loading => _loading; Future initialize( String homeserver, String username, String password) async { _loading = true; _client = Client("zenith"); try { print("Checking homeserver..."); await client.checkHomeserver(Uri.parse(homeserver)); print("Logging in..."); await client.login(LoginType.mLoginPassword, identifier: AuthenticationUserIdentifier(user: username), password: password); } finally { _loading = false; } notifyListeners(); } }