AuthProvider<T extends Auth<AuthKeys>> class

Provides an Authorizer to the widget tree.

IMPORTANT: authorizer কে AuthProvider এর বাইরে State এ তৈরি করো। build() এর ভেতরে new Authorizer() করলে rebuild এ নতুন instance হয়।

// ✅ সঠিক — State এ তৈরি
class _MyState extends State<MyWidget> {
  late final _authorizer = Authorizer<User>(...);

  Widget build(BuildContext context) {
    return AuthProvider<User>(authorizer: _authorizer, child: ...);
  }
}

// ❌ ভুল — build() এ তৈরি
Widget build(BuildContext context) {
  return AuthProvider<User>(
    authorizer: Authorizer<User>(...), // প্রতি rebuild এ নতুন instance!
    child: ...,
  );
}
Inheritance

Constructors

AuthProvider({Key? key, required Authorizer<T> authorizer, required Widget child, bool initialCheck = true, bool listening = false, bool createInstance = false})
const

Properties

authorizer Authorizer<T>
Widget tree এ expose করার Authorizer। State এ তৈরি করা instance pass করো।
final
child Widget
final
createInstance bool
true হলে global singleton হিসেবে register করে। সাধারণত false রাখো — Root এ নিজে dispose করো।
final
hashCode int
The hash code for this object.
no setterinherited
initialCheck bool
Cold start এ cache থেকে user emit করবে কিনা। true রাখো — hot reload এ user null আসবে না।
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listening bool
Realtime auth state changes listen করবে কিনা।
final
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() State<AuthProvider<T>>
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

Static Properties

type Type?
getter/setter pair

Static Methods

authorizerOf<T extends Auth<AuthKeys>>(BuildContext context) Authorizer<T>
maybeAuthorizerOf<T extends Auth<AuthKeys>>(BuildContext context) Authorizer<T>?
maybeOf<T extends Auth<AuthKeys>>(BuildContext context) AuthProvider<T>?
of<T extends Auth<AuthKeys>>(BuildContext context) AuthProvider<T>