cpd_2022_zi/lib/providers/settings_provider.dart

30 lines
667 B
Dart

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;
bool _scanning = false;
Settings? get settings => _settings;
bool get initialized => _initialized;
bool get scanning => _scanning;
set scanning(bool value) {
_scanning = value;
notifyListeners();
}
SettingsProvider() {
initSettings();
}
Future<void> initSettings() async {
_settings = await loadSettings();
_initialized = _settings != null ? true : false;
notifyListeners();
}
}