NotificationsRepository class
UI state control for notifications.
- Inheritance
-
- Object
- BlocBase<
AsyncValue< List< >Notification> > - Cubit<
AsyncValue< List< >Notification> > - Repository<
AsyncValue< List< >Notification> > - NotificationsRepository
Constructors
- NotificationsRepository(NotificationsDatasource _datasource, AuthRepository _auth)
- UI state control for notifications.
Properties
- errorLevel → Level
-
The level to log error messages at.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasUnreadNotifications → bool
-
If
true
the current user has unread notifications.no setter - isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- level → Level
-
The level to log messages at.
no setterinherited
- namespace → String
-
The namespace to log messages under.
e.g. 'Service.Auth'
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ AsyncValue<
List< Notification> > -
The current state.
no setterinherited
-
stream
→ Stream<
AsyncValue< List< >Notification> > -
The current stream of states.
no setterinherited
-
unreadNotifications
→ List<
Notification> -
The unread notifications.
no setter
- updateInterval → Duration
-
The interval at which the repository should update.
If Duration.zero, the repository will not update unless triggered by another repository.
When automatic updates are enabled, the build method will be called with UpdateTrigger at the specified interval.
no setteroverride
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
error
which triggers onError with an optional StackTrace.inherited -
build(
Type trigger) → FutureOr< void> -
Gets called when a repository watched via watch emits a new state or when the repository is initialized (in witch case
trigger
is InitialBuildTrigger). Also gets called when the repository is updated (if updateInterval is not Duration.zero).override -
close(
) → Future< void> -
Closes the instance.
This method should be called when the instance is no longer needed.
Once close is called, the instance can no longer be used.
inherited
-
dispose(
) → void -
Disposes controllers, streams, etc.
override
-
emit(
AsyncValue< List< state) → voidNotification> > -
Updates the
state
to the providedstate
. emit does nothing if thestate
being emitted is equal to the currentstate
.inherited -
filter(
{NotificationType? type, bool? read, DateTime? readBefore, DateTime? readAfter, DateTime? timestampBefore, DateTime? timestampAfter}) → List< Notification> - Filters notifications based on the provided parameters.
-
listen(
void onData(AsyncValue< List< )?, {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription<Notification> >AsyncValue< List< >Notification> > -
Shortcut for Stream.listen.
inherited
-
log(
Object message, [Object? error, StackTrace? stackTrace]) → void -
Logs a message with an optional error and stack trace.
inherited
-
markAllAsRead(
) → Future< void> - Marks all notifications as read.
-
markAsRead(
Notification notification) → Future< void> -
Marks the given
notification
as read. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< AsyncValue< change) → voidList< >Notification> > -
Called whenever a
change
occurs with the givenchange
. Achange
occurs when a newstate
is emitted. onChange is called before thestate
of thecubit
is updated. onChange is a great spot to add logging/analytics for a specificcubit
.inherited -
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
error
occurs and notifies BlocObserver.onError.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
unread(
Notification notification) → Future< void> -
Marks the given
notification
as unread. -
unreadAll(
) → Future< void> - Marks all notifications as unread.
-
watch<
T> (Repository< T> repository) → void -
Watches another
repository
for changes.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited