CalendarPlanRepository class
Repository for managing a user's CalendarPlan.
- Inheritance
-
- Object
- BlocBase<
AsyncValue< CalendarPlan> > - Cubit<
AsyncValue< CalendarPlan> > - Repository<
AsyncValue< CalendarPlan> > - CalendarPlanRepository
Constructors
- CalendarPlanRepository(PlanDatasource _plan, DeadlinesDatasource _deadlines, AuthRepository _auth, ConnectivityService _connectivity, MoodleTasksRepository _tasks, UserRepository _user)
- Repository for managing a user's CalendarPlan.
Properties
- accessType → PlanMemberAccessType
-
Returns the access type of the current user.
no setter
- canModifiy → bool
-
Returns
true
if the current user can modify the plan.no setter - errorLevel → Level
-
The level to log error messages at.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
-
ready
→ Future<
void> -
Future that completes when the repository has finished initializing.
no setterinherited
- refreshOptimization → bool
-
Determines whether refresh optimization is enabled.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ AsyncValue<
CalendarPlan> -
The current state.
no setterinherited
-
stream
→ Stream<
AsyncValue< CalendarPlan> > -
The current stream of states.
no setterinherited
- 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(
BuildTrigger trigger) → Future< void> -
Recalculates the state of the repository.
override
-
changeName(
String name) → Future< void> -
Changes the plan's name to the given
name
. -
chmod(
int userId, PlanMemberAccessType accessType) → Future< void> -
Modifies the access type of the member with the given
userId
. -
clear(
) → Future< void> - Clears the plan.
-
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< CalendarPlan> state) → void -
Updates the
state
to the providedstate
. emit does nothing if thestate
being emitted is equal to the currentstate
.inherited -
filterDeadlines(
{Set< int> ? taskIds, DateTime? start, DateTime? end, DateTime? betweenStart, DateTime? betweenEnd, bool? plannedForToday}) → List<PlanDeadline> - Returns a list of deadlines that match the given filters.
-
filterMembers(
{int? userId, PlanMemberAccessType? accessType}) → List< PlanMember> - Returns a list of members that match the given filters.
-
getUnplannedTasks(
) → List< MoodleTask> - Returns a list of tasks that do not have an associated deadline.
-
kick(
int userId) → Future< void> -
Removes the member with the given
userId
. -
leavePlan(
) → Future< void> - Leaves the shared plan.
-
listen(
void onData(AsyncValue< CalendarPlan> )?, {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription<AsyncValue< CalendarPlan> > -
Shortcut for Stream.listen.
inherited
-
log(
Object message, [Object? error, StackTrace? stackTrace]) → void -
Logs a message with an optional error and stack trace.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< AsyncValue< change) → voidCalendarPlan> > -
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 -
removeDeadline(
int id) → Future< void> -
Removes the deadline with the given
id
. -
setDeadline(
int taskId, DateTime start, DateTime end) → Future< void> -
Sets a deadline for the given
taskId
. -
toString(
) → String -
A string representation of this object.
inherited
-
watch<
T> (Repository< T> repository) → void -
Watches another
repository
for changes.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited