getKillSwitchState method
Get The Current Kill Switch State From Firestore
Implementation
Future<bool> getKillSwitchState() async {
try {
final docRef = _firestore.doc(_collectionPath);
final docSnapshot = await docRef.get();
if (docSnapshot.exists) {
final data = docSnapshot.data();
return data?[_fieldName] ?? false;
} else {
// Document Doesn't Exist, Create It With Default Value False
await docRef.set({_fieldName: false});
return false;
}
} catch (e) {
throw Exception('Failed To Get Kill Switch State: $e');
}
}