refactor: Enable lint use_build_context_synchronously
This commit is contained in:
parent
a3fc1bff01
commit
3296c0d92d
50 changed files with 490 additions and 293 deletions
|
|
@ -5,6 +5,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
|||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:matrix/matrix_api_lite/utils/logs.dart';
|
||||
|
||||
/// Displays a loading dialog which reacts to the given [future]. The dialog
|
||||
/// will be dismissed and the value will be returned when the future completes.
|
||||
|
|
@ -40,6 +41,15 @@ Future<Result<T>> showFutureLoadingDialog<T>({
|
|||
}
|
||||
}
|
||||
|
||||
if (!context.mounted) {
|
||||
Logs().e(
|
||||
'Unable to show loading dialog!',
|
||||
Exception('The BuildContext is not mounted!'),
|
||||
StackTrace.current,
|
||||
);
|
||||
return Result.capture(futureExec);
|
||||
}
|
||||
|
||||
final result = await showAdaptiveDialog<Result<T>>(
|
||||
context: context,
|
||||
barrierDismissible: barrierDismissible,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue