refactor: Enable lint use_build_context_synchronously

This commit is contained in:
Christian Kußowski 2026-03-25 10:42:17 +01:00
commit 3296c0d92d
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
50 changed files with 490 additions and 293 deletions

View file

@ -4,6 +4,7 @@ import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
Future<void> restoreBackupFlow(BuildContext context) async {
final matrix = Matrix.of(context);
final picked = await selectFiles(context);
final file = picked.firstOrNull;
if (file == null) return;
@ -12,9 +13,9 @@ Future<void> restoreBackupFlow(BuildContext context) async {
await showFutureLoadingDialog(
context: context,
future: () async {
final client = await Matrix.of(context).getLoginClient();
final client = await matrix.getLoginClient();
await client.importDump(String.fromCharCodes(await file.readAsBytes()));
Matrix.of(context).initMatrix();
matrix.initMatrix();
},
);
}

View file

@ -166,6 +166,7 @@ class IntroPage extends StatelessWidget {
final client = await Matrix.of(
context,
).getLoginClient();
if (!context.mounted) return;
context.go(
'${GoRouterState.of(context).uri.path}/login',
extra: client,

View file

@ -75,7 +75,8 @@ class _IntroPagePresenterState extends State<IntroPagePresenter> {
final client = await Matrix.of(context).getLoginClient();
await client.checkHomeserver(homeserverUrl);
await client.oidcLogin(session: session, code: code, state: state);
if (context.mounted) context.go('/backup');
if (!mounted) return;
context.go('/backup');
} catch (e, s) {
Logs().w('Unable to login via OIDC', e, s);
if (mounted) {