


# AuthenticationCubit&lt;Data> class






    *[<Null safety>](https://dart.dev/null-safety)*



<p>Abstract authentication cubit class needs to be implemented in application.</p>
<p>This cubit is in charge of managing the global authentication state of
the application.</p>
<p>Its here you can override every callbacks and add your custom logic.</p>



**Inheritance**

- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)
- [BlocBase](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase-class.html)&lt;[AuthenticationState](../wyatt_authentication_bloc/AuthenticationState-class.md)&lt;Data>>
- [Cubit](https://pub.dev/documentation/bloc/8.1.0/bloc/Cubit-class.html)&lt;[AuthenticationState](../wyatt_authentication_bloc/AuthenticationState-class.md)&lt;Data>>
- AuthenticationCubit








## Constructors

[AuthenticationCubit](../wyatt_authentication_bloc/AuthenticationCubit/AuthenticationCubit.md) ({required [AuthenticationRepository](../wyatt_authentication_bloc/AuthenticationRepository-class.md)&lt;Data> authenticationRepository})

   


## Properties

##### [authenticationRepository](../wyatt_authentication_bloc/AuthenticationCubit/authenticationRepository.md) &#8594; [AuthenticationRepository](../wyatt_authentication_bloc/AuthenticationRepository-class.md)&lt;Data>



  
_<span class="feature">final</span>_



##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) &#8594; [int](https://api.flutter.dev/flutter/dart-core/int-class.html)



The hash code for this object.  
_<span class="feature">read-only</span><span class="feature">inherited</span>_



##### [isClosed](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/isClosed.html) &#8594; [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)



Whether the bloc is closed.  
_<span class="feature">read-only</span><span class="feature">inherited</span>_



##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) &#8594; [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html)



A representation of the runtime type of the object.  
_<span class="feature">read-only</span><span class="feature">inherited</span>_



##### [state](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/state.html) &#8594; [AuthenticationState](../wyatt_authentication_bloc/AuthenticationState-class.md)&lt;Data>



The current <a href="https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/state.html">state</a>.  
_<span class="feature">read-only</span><span class="feature">inherited</span>_



##### [stream](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/stream.html) &#8594; [Stream](https://api.flutter.dev/flutter/dart-async/Stream-class.html)&lt;[AuthenticationState](../wyatt_authentication_bloc/AuthenticationState-class.md)&lt;Data>>



The current <a href="https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/stream.html">stream</a> of states.  
_<span class="feature">read-only</span><span class="feature">inherited</span>_





## Methods

##### [addError](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/addError.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) error, [[StackTrace](https://api.flutter.dev/flutter/dart-core/StackTrace-class.html)? stackTrace]) void



Reports an <code>error</code> which triggers <a href="https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/onError.html">onError</a> with an optional <a href="https://api.flutter.dev/flutter/dart-core/StackTrace-class.html">StackTrace</a>.  
_<span class="feature">inherited</span>_



##### [close](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/close.html)() [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)&lt;void>



Closes the instance.
This method should be called when the instance is no longer needed.
Once <a href="https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/close.html">close</a> is called, the instance can no longer be used.  
_<span class="feature">inherited</span>_



##### [currentSession](../wyatt_authentication_bloc/AuthenticationCubit/currentSession.md)() [SessionWrapper](../wyatt_authentication_bloc/SessionWrapper-class.md)&lt;Data>?



Returns latest session wrapper.  




##### [delete](../wyatt_authentication_bloc/AuthenticationCubit/delete.md)() [FutureOr](https://api.flutter.dev/flutter/dart-async/FutureOr-class.html)&lt;void>



Delete account.  




##### [emit](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/emit.html)([AuthenticationState](../wyatt_authentication_bloc/AuthenticationState-class.md)&lt;Data> state) void



Updates the <code>state</code> to the provided <code>state</code>.
<a href="https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/emit.html">emit</a> does nothing if the <code>state</code> being emitted
is equal to the current <code>state</code>.  
_<span class="feature">inherited</span>_



##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic



Invoked when a non-existent method or property is accessed.  
_<span class="feature">inherited</span>_



##### [onChange](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/onChange.html)([Change](https://pub.dev/documentation/bloc/8.1.0/bloc/Change-class.html)&lt;[AuthenticationState](../wyatt_authentication_bloc/AuthenticationState-class.md)&lt;Data>> change) void



Called whenever a <code>change</code> occurs with the given <code>change</code>.
A <code>change</code> occurs when a new <code>state</code> is emitted.
<a href="https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/onChange.html">onChange</a> is called before the <code>state</code> of the <code>cubit</code> is updated.
<a href="https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/onChange.html">onChange</a> is a great spot to add logging/analytics for a specific <code>cubit</code>.  
_<span class="feature">inherited</span>_



##### [onDelete](../wyatt_authentication_bloc/AuthenticationCubit/onDelete.md)() FutureOrResult&lt;void>



This callback is triggered when the current account is deleted from
the remote.  




##### [onError](https://pub.dev/documentation/bloc/8.1.0/bloc/BlocBase/onError.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) error, [StackTrace](https://api.flutter.dev/flutter/dart-core/StackTrace-class.html) stackTrace) void



Called whenever an <code>error</code> occurs and notifies <a href="https://pub.dev/documentation/bloc/8.1.0/bloc/BlocObserver/onError.html">BlocObserver.onError</a>.  
_<span class="feature">inherited</span>_



##### [onReauthenticate](../wyatt_authentication_bloc/AuthenticationCubit/onReauthenticate.md)(Result&lt;[Account](../wyatt_authentication_bloc/Account-class.md), AppException> result) FutureOrResult&lt;Data?>



This callback is triggered when the account is re-authenticated  




##### [onRefresh](../wyatt_authentication_bloc/AuthenticationCubit/onRefresh.md)(Result&lt;[Account](../wyatt_authentication_bloc/Account-class.md), AppException> result) FutureOrResult&lt;Data?>



This callback is triggered when the account is refreshed.  




##### [onSignInFromCache](../wyatt_authentication_bloc/AuthenticationCubit/onSignInFromCache.md)([SessionWrapper](../wyatt_authentication_bloc/SessionWrapper-class.md)&lt;Data> wrapper) FutureOrResult&lt;Data?>



This callback is triggered when the user is automaticcaly logged in from
the cache.  




##### [onSignOut](../wyatt_authentication_bloc/AuthenticationCubit/onSignOut.md)() FutureOrResult&lt;void>



This callback is triggered when the user is logged out.  




##### [reauthenticate](../wyatt_authentication_bloc/AuthenticationCubit/reauthenticate.md)() [FutureOr](https://api.flutter.dev/flutter/dart-async/FutureOr-class.html)&lt;void>



Some security-sensitive actions—such as deleting an account,
setting a primary email address, and changing a password—require that
the user has recently signed in.  




##### [refresh](../wyatt_authentication_bloc/AuthenticationCubit/refresh.md)() [FutureOr](https://api.flutter.dev/flutter/dart-async/FutureOr-class.html)&lt;void>



Refreshes the current user, if signed in.  




##### [signOut](../wyatt_authentication_bloc/AuthenticationCubit/signOut.md)() [FutureOr](https://api.flutter.dev/flutter/dart-async/FutureOr-class.html)&lt;void>



Signs out the current user.
It also clears the cache and the associated data.  




##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html)



A string representation of this object.  
_<span class="feature">inherited</span>_





## Operators

##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)



The equality operator.  
_<span class="feature">inherited</span>_















