KoolbaseAuthGate class

Branches the widget tree on authentication state, correctly.

Owns the behavior every app hand-writes and most get subtly wrong:

Appearance is entirely yours — the gate is headless with slots:

KoolbaseAuthGate(
  signedIn: (context, user) => HomeScreen(user: user),
  signedOut: (context) => const LoginScreen(),
  // restoring: optional — defaults to a bare centered spinner.
)

Descendants read the current user without touching statics, and rebuild when it changes:

final user = KoolbaseAuthScope.of(context).user;
Inheritance

Constructors

KoolbaseAuthGate({Key? key, required Widget signedIn(BuildContext context, KoolbaseUser user), required Widget signedOut(BuildContext context), Widget restoring(BuildContext context)?, @visibleForTesting KoolbaseAuthClient? auth})
const

Properties

auth KoolbaseAuthClient?
Test seam only: the auth client to drive instead of Koolbase.auth. Production callers never pass this — the gate reads the singleton.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
restoring Widget Function(BuildContext context)?
Built while the persisted session is being restored at mount.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signedIn Widget Function(BuildContext context, KoolbaseUser user)
Built when a user is signed in. Receives the current KoolbaseUser.
final
signedOut Widget Function(BuildContext context)
Built when no user is signed in (never signed in, logged out, or the persisted session expired).
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<KoolbaseAuthGate>
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