Service class
Service class to store global variables Used to store the domain, token, cookie, loading widget etc This class methods can be used to set and get the values This class methods use top level variables to store the values
Constructors
- Service()
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 Properties
- apiUrl → dynamic
-
apiUrl method to get the total url with domain and extra path
no setter
- getCookie → dynamic
-
getCookie method to get the cookie
no setter
- getLoadingWidget → Widget?
-
getLoadingWidget method to get the loading widget
used when api calls
no setter
- getNeedLoadingMsg → bool
-
getNeedLoadingMsg method to get the need loading message
used when api calls
no setter
- getToken → dynamic
-
getToken method to get the token for authentication
Every request will be sent with this token where needed
no setter
- getTokenKey → dynamic
-
getTokenKey method to get the token key
There are some cases where token key is needed
like Authorization, Token etc
no setter
- getTokenPrefix → dynamic
-
getTokenPrefix method to get the token prefix
There are some cases where token prefix is needed
like Bearer, JWT etc
no setter
- url → dynamic
-
url method to get the domain
no setter
Static Methods
-
delAuthToken(
dynamic _) → dynamic - delAuthToken method to delete the token for authentication Used when user logs out or token is expired etc
-
domain(
String path) → dynamic - domain method to set the api domain or ordinary domain or base url
-
extraSlag(
String? path) → dynamic - extraSlag method to set the api domain with extra path Previously set domain will be used as base url
-
setAuthToken(
String token) → dynamic - setAuthToken method to set the token for authentication Every request will be sent with this token where needed
-
setAuthTokenKey(
String key) → dynamic - setAuthTokenKey method to set the token key There are some cases where token key is needed like Authorization, Token etc
-
setAuthTokenPrefix(
String prefix) → dynamic - setAuthTokenPrefix method to set the token prefix There are some cases where token prefix is needed like Bearer, JWT etc
-
setCookie(
String cookie) → dynamic - setCookie method to set the cookie
-
setLoadingWidget(
Widget loading) → dynamic - setLoadingWidget method to set the loading widget used when api calls
-
setNeedLoadingMsg(
bool needLoadingMsg) → dynamic - setNeedLoadingMsg method to set the need loading message used when api calls