KillSwitchWrapper class

A wrapper widget that monitors the kill switch state and automatically displays a blocking dialog when the kill switch is activated.

This widget should wrap your main app content to provide kill switch functionality. When the kill switch is enabled in Firebase Firestore, it will immediately show a KillSwitchDialog that prevents users from accessing the app.

Features

  • Real-time monitoring: Listens to Firebase Firestore for kill switch changes
  • Instant response: Shows/hides dialog immediately when state changes
  • App blocking: Completely blocks app access when kill switch is active
  • Graceful handling: Properly manages dialog lifecycle and state

Usage

Wrap your main app widget with KillSwitchWrapper:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: KillSwitchWrapper(
        child: YourMainScreen(), // Your app's content
      ),
    );
  }
}

Behavior

  • When kill switch is false: Displays the child widget normally
  • When kill switch is true: Shows blocking dialog and loading screen
  • Dialog cannot be dismissed by user (barrierDismissible: false)
  • Only way to close is through the "Close App" button which exits the app

See also:

  • FlutterKillSwitch, the admin interface for controlling the kill switch
  • KillSwitchDialog, the blocking dialog shown to users
  • FirebaseService, the service that handles Firestore operations
Inheritance

Constructors

KillSwitchWrapper.new({Key? key, required Widget child})
Creates a kill switch wrapper.
const

Properties

child Widget
The child widget to display when the kill switch is inactive.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() KillSwitchWrapperState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited