cpd_2022_zi/lib/providers/settings_provider.dart

30 lines
667 B
Dart
Raw Permalink Normal View History

2023-02-27 02:27:42 +01:00
import 'package:flutter/material.dart';
import 'package:smoke_cess_app/services/settings_service.dart';
import '../models/settings.dart';
class SettingsProvider extends ChangeNotifier {
Settings? _settings;
bool _initialized = false;
2023-03-06 14:25:38 +01:00
bool _scanning = false;
2023-02-27 02:27:42 +01:00
Settings? get settings => _settings;
bool get initialized => _initialized;
2023-03-06 14:25:38 +01:00
bool get scanning => _scanning;
set scanning(bool value) {
_scanning = value;
notifyListeners();
}
2023-02-27 02:27:42 +01:00
SettingsProvider() {
initSettings();
}
2023-03-06 21:54:32 +01:00
Future<void> initSettings() async {
_settings = await loadSettings();
_initialized = _settings != null ? true : false;
2023-02-27 02:27:42 +01:00
notifyListeners();
}
}