KAuthBuilder class

인증 상태에 따라 화면을 자동으로 전환하는 위젯

기본 사용법

KAuthBuilder(
  stream: kAuth.authStateChanges,
  signedIn: (user) => HomeScreen(user: user),
  signedOut: () => LoginScreen(),
)

토큰 만료 처리

KAuthBuilder(
  stream: kAuth.authStateChanges,
  signedIn: (user) => HomeScreen(user: user),
  signedOut: () => LoginScreen(),
  expiring: () => TokenRefreshBanner(),  // 만료 임박 시 표시
  isExpiring: kAuth.isExpiringSoon,      // 만료 임박 여부 판단
)

모든 상태 처리

KAuthBuilder(
  stream: kAuth.authStateChanges,
  signedIn: (user) => HomeScreen(user: user),
  signedOut: () => LoginScreen(),
  loading: () => SplashScreen(),
  error: (e) => ErrorScreen(error: e),
  expiring: () => TokenRefreshBanner(),
  isExpiring: kAuth.isExpiringSoon,
)
Inheritance

Constructors

KAuthBuilder({Key? key, required Stream<KAuthUser?> stream, required Widget signedIn(KAuthUser user), required Widget signedOut(), Widget loading()?, Widget error(Object error)?, Widget expiring()?, bool isExpiring()?, KAuthUser? initialUser})
const

Properties

error Widget Function(Object error)?
에러 발생 시 표시할 위젯 (선택)
final
expiring Widget Function()?
토큰 만료 임박 시 표시할 위젯 (선택)
final
hashCode int
The hash code for this object.
no setterinherited
initialUser KAuthUser?
초기 사용자 (스트림 연결 전)
final
isExpiring bool Function()?
토큰 만료 임박 여부를 판단하는 함수 (선택)
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loading Widget Function()?
로딩 중일 때 표시할 위젯 (선택)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signedIn Widget Function(KAuthUser user)
로그인 상태일 때 표시할 위젯
final
signedOut Widget Function()
로그아웃 상태일 때 표시할 위젯
final
stream Stream<KAuthUser?>
인증 상태 변화 스트림
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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