diff options
Diffstat (limited to 'lib/jotai.dart')
| -rw-r--r-- | lib/jotai.dart | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/jotai.dart b/lib/jotai.dart index 5524e6a..dc1b165 100644 --- a/lib/jotai.dart +++ b/lib/jotai.dart @@ -41,7 +41,15 @@ Future<T> fromString<T>( .then( // Going through all of these sounds like it's slower than necessary, // but it's very simple, and most of the options lists are very small. - (value) => options.firstWhere((option) => value == toString(option)), + (value) { + try { + return options.firstWhere((option) => value == toString(option)); + } catch (error, stack) { + logObservable.value = logObservable.value + ..add('While loading $key:\n$error\n$stack'); + rethrow; + } + }, ); } @@ -82,6 +90,8 @@ final locationAccuracyObservable = observablePreference( LocationAccuracy.values, ); +final logObservable = Observable(<String>[]); + class Observable<T> { T _value; int _nextId = 0; |
