Skip to content

Commit e36f984

Browse files
committed
log [nfc]: Revise reportErrorToUserBriefly doc; tweak related comments
1 parent 2d5624c commit e36f984

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/log.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ bool debugLog(String message) {
3333

3434
typedef ReportErrorCallback = void Function(String? message, {String? details});
3535

36-
/// Display an error message in a [SnackBar].
36+
/// Show the user an error message, without requiring them to interact with it.
3737
///
38-
/// This shows a [SnackBar] containing the message if [ZulipApp] is ready,
39-
/// otherwise logs it to the console.
38+
/// Typically this shows a [SnackBar] containing the message.
39+
/// If called before the app's widget tree is ready (see [ZulipApp.ready]),
40+
/// then we give up on showing the message to the user,
41+
/// and just log the message to the console.
4042
///
4143
/// If `message` is null, this will clear the existing [SnackBar]s if there
4244
/// are any. Useful for promptly dismissing errors.

lib/widgets/app.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ class ZulipApp extends StatefulWidget {
9898

9999
static int _snackBarCount = 0;
100100

101+
/// The callback we normally use as [reportErrorToUserBriefly].
101102
static void _reportErrorToUserBriefly(String? message, {String? details}) {
102103
assert(_ready.value);
103104

104105
if (message == null) {
105106
if (_snackBarCount == 0) return;
106107
assert(_snackBarCount > 0);
107-
// The snack bar API only exposes ways to hide ether the current snack
108+
// The [SnackBar] API only exposes ways to hide ether the current snack
108109
// bar or all of them.
109110
//
110111
// To reduce the possibility of hiding snack bars not created by this

0 commit comments

Comments
 (0)