Skip to content

Commit eb95695

Browse files
committed
Enable HIVE logs in none release mode builds
1 parent f155c15 commit eb95695

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

example/lib/shared/services/theme_service_hive.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'theme_service_hive_adapters.dart';
1010
// The handy part is that if it gets in the way in debugging, it is an easy
1111
// toggle to turn it off here too. Often I just leave them true if it is one
1212
// I want to see in dev mode, unless it is too chatty.
13-
const bool _debug = !kReleaseMode && false;
13+
const bool _debug = !kReleaseMode && true;
1414

1515
/// A [ThemeService] implementation that stores and retrieves theme settings
1616
/// locally using the package Hive: https://pub.dev/packages/hive
@@ -105,15 +105,14 @@ class ThemeServiceHive implements ThemeService {
105105
@override
106106
Future<T> load<T>(String key, T defaultValue) async {
107107
try {
108-
final dynamic gotValue = _hiveBox.get(key, defaultValue: defaultValue);
108+
final dynamic value = _hiveBox.get(key, defaultValue: defaultValue);
109109
if (_debug) {
110110
debugPrint('Hive LOAD _______________');
111111
debugPrint(' Type expected: $key as ${defaultValue.runtimeType}');
112-
debugPrint(' Type loaded : $key as ${gotValue.runtimeType}');
113-
debugPrint(' Value loaded : $gotValue');
112+
debugPrint(' Type loaded : $key as ${value.runtimeType}');
113+
debugPrint(' Value loaded : $value');
114114
}
115-
final T loaded = gotValue as T;
116-
return loaded;
115+
return value as T;
117116
} catch (e) {
118117
debugPrint('Hive load (get) ERROR');
119118
debugPrint(' Error message ...... : $e');

0 commit comments

Comments
 (0)