Role class

Role hierarchy for authorization checks.

Built-in roles support implicit hierarchy: admin implies manager implies user implies guest.

Constructors

Role(String name, {int level = 0})
const

Properties

hashCode int
The hash code for this object.
no setteroverride
level int
Numeric level for hierarchy comparison. Higher = more privileged.
final
name String
The display name of the role.
final
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.
override

Operators

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

Static Methods

satisfies(Role candidate, Role requiredRole) bool
Check whether candidate satisfies requiredRole according to the built-in hierarchy.

Constants

admin → const Role
guest → const Role
manager → const Role
user → const Role