mirror of
https://github.com/madari-media/madari-oss.git
synced 2026-04-28 17:42:57 +00:00
37 lines
698 B
Dart
37 lines
698 B
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
class StateProvider extends ChangeNotifier {
|
|
final Map<String, dynamic> _state = {};
|
|
String _search = "";
|
|
|
|
Map<String, dynamic> get state => _state;
|
|
String get search => _search;
|
|
|
|
dynamic getValue(String key) {
|
|
return _state[key];
|
|
}
|
|
|
|
void setSearch(String search) {
|
|
_search = search;
|
|
notifyListeners();
|
|
}
|
|
|
|
void setValue(String key, dynamic value) {
|
|
_state[key] = value;
|
|
notifyListeners();
|
|
}
|
|
|
|
void removeValue(String key) {
|
|
_state.remove(key);
|
|
notifyListeners();
|
|
}
|
|
|
|
void clearAll() {
|
|
_state.clear();
|
|
notifyListeners();
|
|
}
|
|
|
|
bool hasKey(String key) {
|
|
return _state.containsKey(key);
|
|
}
|
|
}
|