TokenFormatConfig class
Token格式配置
Constructors
- TokenFormatConfig({String headerKey = 'Authorization', String? prefix, bool useSpaceAfterPrefix = true})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- headerKey → String
-
Token在请求头中的key,默认为 'Authorization'
final
- prefix → String?
-
Token的前缀,例如 'Bearer',默认为空
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- useSpaceAfterPrefix → bool
-
Token和后缀之间是否用空格分隔,默认为true
final
Methods
-
format(
String token) → String - 格式化为最终的Header值
-
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
-
bearer(
) → TokenFormatConfig - 默认格式:Authorization: Bearer {token}
-
custom(
String headerKey) → TokenFormatConfig - 自定义Header Key格式:CustomKey: {token}