ApiRequestOptions class

Constructors

ApiRequestOptions()

Properties

baseUrl String
base url for your api You can set it ApiRequestOptions.instance.baseUrl = 'https://example.com';
getter/setter pair
connectTimeout Duration?
Timeout in milliseconds for opening url. Dio will throw the DioException with DioExceptionType.connectTimeout type when time out.
getter/setter pair
defaultHeaders Map<String, dynamic>
getter/setter pair
defaultQueryParameters Map<String, dynamic>
getter/setter pair
enableLog bool
to disable log set it to false
getter/setter pair
errorBuilder ↔ (dynamic Function(Map<String, dynamic> data)?)
getter/setter pair
getAsyncToken GetAsyncOption<String?>?
get access token use async callback function
getter/setter pair
getToken GetOption<String?>?
get access token use callback function
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
interceptors List<ApiInterceptor>
list of global interceptors
getter/setter pair
listFormat ListFormat
getter/setter pair
onError ↔ (dynamic Function(ActionRequestError error)?)
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
token String?
access token
getter/setter pair
tokenType String?
set tokenType for types
getter/setter pair
unauthenticated GetOption?
write what you wont if your server response unauthenticated with status code 401
getter/setter pair

Methods

config({String? baseUrl, String? token, GetOption<String?>? getToken, GetAsyncOption<String?>? getAsyncToken, GetOption? unauthenticated, Map<String, dynamic>? defaultQueryParameters, Map<String, dynamic>? defaultHeaders, String? tokenType, Duration? connectTimeout, bool? enableLog, List<ApiInterceptor>? interceptors, dynamic onError(ActionRequestError error)?, dynamic errorBuilder(Map<String, dynamic> data)?, ListFormat? listFormat}) → void
getTokenString() Future<String?>
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 Properties

bearer String
for Bearer token type.
getter/setter pair
instance ApiRequestOptions?
Singleton for ApiRequestOptions by create one instance
no setter

Static Methods

refreshConfig() → dynamic