File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -30,3 +30,13 @@ bool debugLog(String message) {
30
30
}());
31
31
return true ;
32
32
}
33
+
34
+ void Function (String message) reportErrorToUserBriefly = _defaultReportErrorToUserBriefly;
35
+
36
+ void _defaultReportErrorToUserBriefly (String message) {
37
+ // If this callback is still in place, then the app's widget tree
38
+ // hasn't mounted yet even as far as the [Navigator].
39
+ // So there's not much we can do to tell the user;
40
+ // just log, in case the user is actually a developer watching the console.
41
+ assert (debugLog (message));
42
+ }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
5
5
import 'package:flutter/scheduler.dart' ;
6
6
import 'package:flutter_gen/gen_l10n/zulip_localizations.dart' ;
7
7
8
+ import '../log.dart' ;
8
9
import '../model/localizations.dart' ;
9
10
import '../model/narrow.dart' ;
10
11
import 'about_zulip.dart' ;
@@ -92,9 +93,14 @@ class ZulipApp extends StatefulWidget {
92
93
/// Useful in tests.
93
94
final List <NavigatorObserver >? navigatorObservers;
94
95
96
+ static void _reportErrorToUserBriefly (String message) {
97
+ scaffoldMessenger? .showSnackBar (SnackBar (content: Text (message)));
98
+ }
99
+
95
100
void _declareReady () {
96
101
assert (navigatorKey.currentContext != null );
97
102
_ready.value = true ;
103
+ reportErrorToUserBriefly = _reportErrorToUserBriefly;
98
104
}
99
105
100
106
@override
You can’t perform that action at this time.
0 commit comments