mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-06 11:09:28 +00:00
use logging package
This commit is contained in:
parent
99fb8264f1
commit
f24e63d852
14 changed files with 135 additions and 86 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// this provider is used to provide the app settings to the app
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:whispering_pages/db/available_boxes.dart';
|
||||
import 'package:whispering_pages/settings/models/app_settings.dart' as model;
|
||||
|
|
@ -9,6 +9,8 @@ part 'app_settings_provider.g.dart';
|
|||
|
||||
final _box = AvailableHiveBoxes.userPrefsBox;
|
||||
|
||||
final _logger = Logger('AppSettingsProvider');
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class AppSettings extends _$AppSettings {
|
||||
@override
|
||||
|
|
@ -24,12 +26,12 @@ class AppSettings extends _$AppSettings {
|
|||
// see if the settings are already in the box
|
||||
if (_box.isNotEmpty) {
|
||||
final foundSettings = _box.getAt(0);
|
||||
debugPrint('found settings in box: $foundSettings');
|
||||
_logger.fine('found settings in box: $foundSettings');
|
||||
return foundSettings;
|
||||
} else {
|
||||
// create a new settings object
|
||||
const settings = model.AppSettings();
|
||||
debugPrint('created new settings: $settings');
|
||||
_logger.fine('created new settings: $settings');
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +40,7 @@ class AppSettings extends _$AppSettings {
|
|||
void writeToBox() {
|
||||
_box.clear();
|
||||
_box.add(state);
|
||||
debugPrint('wrote settings to box: $state');
|
||||
_logger.fine('wrote settings to box: $state');
|
||||
}
|
||||
|
||||
void toggleDarkMode() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue