UserfrontApi class

A utility class to interface with the Userfront API while managing access token refresh.

Constructors

UserfrontApi(dynamic tokenStore, {String origin = '', String baseUrl = 'api.userfront.com', Client? httpClient})
Constructs a UserfrontApi instance.

Properties

baseUrl String
The base URL for the API. To function correctly in production, should be kept as its default value 'api.userfront.com'.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
httpClient ↔ Client?
The HTTP client to use for requests. May be overridden for automated testing, etc.
getter/setter pair
origin String
The value of the origin header in requests.
getter/setter pair
pathPrefix String
A path prefix to put between the baseUrl and the API route.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(String endpoint, {Map<String, dynamic>? options}) Future<Response>
Sends a DELETE request to the Userfront API.
get(String endpoint, {Map<String, dynamic>? options}) Future<Response>
Sends a GET request to the Userfront API.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post(String endpoint, {Map<String, dynamic>? options}) Future<Response>
Sends a POST request to the Userfront API.
put(String endpoint, {Map<String, dynamic>? options}) Future<Response>
Sends a PUT request to the Userfront API.
refresh() Future<bool>
Refreshes the _tokenStore.accessToken if possible. Returns true if the _tokenStore.accessToken was refreshed, false otherwise.
toString() String
A string representation of this object.
inherited

Operators

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