AuthBloc class
- Inheritance
- Object
- Stream<
AuthState> - AuthBloc
Constructors
Properties
- app → FbApp
-
final
- deleteUser → dynamic Function()
-
Called when the user logs out. You can use this method for updating a database.
final
-
first
→ Future<
AuthState> -
The first element of this stream. [...]
read-only, inherited
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- initialState → AuthState
-
Returns the state before any
events
have been added.read-only - isBroadcast → bool
-
Returns whether the
Stream<State>
is a broadcast stream.read-only, inherited -
isEmpty
→ Future<
bool> -
Whether this stream contains any elements. [...]
read-only, inherited
-
last
→ Future<
AuthState> -
The last element of this stream. [...]
read-only, inherited
-
length
→ Future<
int> -
The number of elements in this stream. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- saveUser → dynamic Function(AuthUser)
-
Called every time the user info changes. You can use this method for updating a database.
final
-
single
→ Future<
AuthState> -
The single element of this stream. [...]
read-only, inherited
- state → AuthState
-
Returns the current state of the bloc.
read-only, inherited
Methods
-
add(
AuthEvent event) → void -
Notifies the bloc of a new
event
which triggers mapEventToState. If close has already been called, any subsequent calls to add will be delegated to the onError method which can be overriden at the bloc as well as theBlocDelegate
level.inherited -
any(
bool test(AuthState element)) → Future< bool> -
Checks whether
test
accepts any element provided by this stream. [...]inherited -
asBroadcastStream(
{void onListen(StreamSubscription< AuthState> subscription), void onCancel(StreamSubscription<AuthState> subscription)}) → Stream<AuthState> -
Returns a multi-subscription stream that produces the same events as this. [...]
inherited
-
asyncExpand<
E> (Stream< E> convert(AuthState event)) → Stream<E> -
Transforms each element into a sequence of asynchronous events. [...]
inherited
-
asyncMap<
E> (FutureOr< E> convert(AuthState event)) → Stream<E> -
Creates a new stream with each data event of this stream asynchronously
mapped to a new event. [...]
inherited
-
cast<
R> () → Stream< R> -
Adapt this stream to be a
Stream<R>
. [...]inherited -
close(
) → Future< void> -
Closes the
event
andstate
Streams
. This method should be called when a bloc is no longer needed. Once close is called,events
that are added will not be processed and will result in an error being passed to onError. In addition, if close is called whileevents
are still being processed, the bloc will continue to process the pendingevents
to completion.@mustCallSuper, inherited -
contains(
Object needle) → Future< bool> -
Returns whether
needle
occurs in the elements provided by this stream. [...]inherited -
distinct(
[bool equals(AuthState previous, AuthState next)]) → Stream< AuthState> -
Skips data events if they are equal to the previous data event. [...]
inherited
-
drain<
E> ([E futureValue]) → Future< E> -
Discards all data on this stream, but signals when it is done or an error
occurred. [...]
inherited
-
elementAt(
int index) → Future< AuthState> -
Returns the value of the
index
th data event of this stream. [...]inherited -
every(
bool test(AuthState element)) → Future< bool> -
Checks whether
test
accepts all elements provided by this stream. [...]inherited -
expand<
S> (Iterable< S> convert(AuthState element)) → Stream<S> -
Transforms each element of this stream into a sequence of elements. [...]
inherited
-
firstWhere(
bool test(AuthState element), {AuthState orElse()}) → Future< AuthState> -
Finds the first element of this stream matching
test
. [...]inherited -
fold<
S> (S initialValue, S combine(S previous, AuthState element)) → Future< S> -
Combines a sequence of values by repeatedly applying
combine
. [...]inherited -
forEach(
void action(AuthState element)) → Future -
Executes
action
on each element of this stream. [...]inherited -
handleError(
Function onError, {bool test(dynamic error)}) → Stream< AuthState> -
Creates a wrapper Stream that intercepts some errors from this stream. [...]
inherited
-
join(
[String separator = ""]) → Future< String> -
Combines the string representation of elements into a single string. [...]
inherited
-
lastWhere(
bool test(AuthState element), {AuthState orElse()}) → Future< AuthState> -
Finds the last element in this stream matching
test
. [...]inherited -
listen(
void onData(AuthState), {Function onError, void onDone(), bool cancelOnError}) → StreamSubscription< AuthState> -
Adds a subscription to the
Stream<State>
. Returns aStreamSubscription
which handles events from theStream<State>
using the providedonData
,onError
andonDone
handlers.inherited -
map<
S> (S convert(AuthState event)) → Stream< S> -
Transforms each element of this stream into a new stream event. [...]
inherited
-
mapEventToState(
AuthEvent event) → Stream< AuthState> -
Must be implemented when a class extends bloc.
Takes the incoming
event
as the argument. mapEventToState is called whenever anevent
is added. mapEventToState must convert thatevent
into a new state and return the new state in the form of aStream<State>
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
onError(
Object error, StackTrace stacktrace) → void -
Called whenever an
error
is thrown within mapEventToState. By default allerror
s will be ignored and bloc functionality will be unaffected. Thestacktrace
argument may benull
if the state stream received an error without astacktrace
. A great spot to handle errors at the individualBloc
level.inherited -
onEvent(
AuthEvent event) → void -
Called whenever an
event
is added to the bloc. A great spot to add logging/analytics at the individual bloc level.inherited -
onTransition(
Transition< AuthEvent, AuthState> transition) → void -
Called whenever a
transition
occurs with the giventransition
. Atransition
occurs when a newevent
is added and mapEventToState executed. onTransition is called before a bloc's state has been updated. A great spot to add logging/analytics at the individual bloc level.inherited -
pipe(
StreamConsumer< AuthState> streamConsumer) → Future -
Pipes the events of this stream into
streamConsumer
. [...]inherited -
reduce(
AuthState combine(AuthState previous, AuthState element)) → Future< AuthState> -
Combines a sequence of values by repeatedly applying
combine
. [...]inherited -
singleWhere(
bool test(AuthState element), {AuthState orElse()}) → Future< AuthState> -
Finds the single element in this stream matching
test
. [...]inherited -
skip(
int count) → Stream< AuthState> -
Skips the first
count
data events from this stream. [...]inherited -
skipWhile(
bool test(AuthState element)) → Stream< AuthState> -
Skip data events from this stream while they are matched by
test
. [...]inherited -
take(
int count) → Stream< AuthState> -
Provides at most the first
count
data events of this stream. [...]inherited -
takeWhile(
bool test(AuthState element)) → Stream< AuthState> -
Forwards data events while
test
is successful. [...]inherited -
timeout(
Duration timeLimit, {void onTimeout(EventSink< AuthState> sink)}) → Stream<AuthState> -
Creates a new stream with the same events as this stream. [...]
inherited
-
toList(
) → Future< List< AuthState> > -
Collects all elements of this stream in a
List
. [...]inherited -
toSet(
) → Future< Set< AuthState> > -
Collects the data of this stream in a
Set
. [...]inherited -
toString(
) → String -
Returns a string representation of this object.
inherited
-
transform<
S> (StreamTransformer< AuthState, S> streamTransformer) → Stream<S> -
Applies
streamTransformer
to this stream. [...]inherited -
transformEvents(
Stream< AuthEvent> events, Stream<AuthState> next(AuthEvent)) → Stream<AuthState> -
Transforms the
events
stream along with anext
function into aStream<State>
. Events that should be processed by mapEventToState need to be passed tonext
. By defaultasyncExpand
is used to ensure allevents
are processed in the order in which they are received. You can override transformEvents for advanced usage in order to manipulate the frequency and specificity with which mapEventToState is called as well as whichevents
are processed. [...]inherited -
transformStates(
Stream< AuthState> states) → Stream<AuthState> -
Transforms the
Stream<State>
into a newStream<State>
. By default transformStates returns the incomingStream<State>
. You can override transformStates for advanced usage in order to manipulate the frequency and specificity at whichtransitions
(state changes) occur. [...]inherited -
where(
bool test(AuthState event)) → Stream< AuthState> -
Creates a new stream from this stream that discards some elements. [...]
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
Static Methods
-
currentUser(
BuildContext context) → AuthUser