NyAction class

Nylo's NyAction class

Constructors

NyAction()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

authorized(FutureOr<void> perform(), {required FutureOr<bool> when(), FutureOr<void> unauthorized()?}) Future<void>
Perform an action only if the user is authorized to do so. Provide a perform callback to execute if the user is authorized. Provide a when callback to check if the user is authorized. Provide an unauthorized callback to execute if the user is not authorized.
limitPerDay(String actionKey, FutureOr<void> perform(), {int maxPerDay = 5, FutureOr<void> unauthorized()?}) Future<void>
Limit the number of times an action can be performed in a day. Provide an actionKey for the action you want to limit. Provide a perform callback to execute if the user is authorized. Provide a maxPerDay to limit the number of times the action can be performed. Provide an unauthorized callback to execute if the limit is reached.