NyApiService class
- Inheritance
- 
    - Object
- DioApiService
- NyApiService
 
Constructors
- 
          NyApiService(BuildContext? context, {Map<Type, dynamic> ? decoders = const {}, BaseOptions baseOptions(BaseOptions baseOptions)?, Dio initDio(Dio api)?})
Properties
- baseOptions ↔ BaseOptions?
- 
  Base options for the request
  getter/setter pairinherited
- baseUrl → String
- 
  Base URL for the request
  finalinherited
- 
  decoders
  → Map<Type, dynamic> ?
- 
  Map decoders to modelDecoders
  final
- hashCode → int
- 
  The hash code for this object.
  no setterinherited
- 
  interceptors
  → Map<Type, Interceptor> 
- 
  Default interceptors
  no setteroverride
- retry ↔ int
- 
  how many times should the request retry
  getter/setter pairinherited
- retryDelay ↔ Duration
- 
  how long should the request wait before retrying
  getter/setter pairinherited
- retryIf ↔ bool Function(DioException dioException)?
- 
  should the request retry if the retryIf callback returns true
  getter/setter pairinherited
- runtimeType → Type
- 
  A representation of the runtime type of the object.
  no setterinherited
- shouldSetAuthHeaders ↔ bool
- 
  should the request retry if the retryIf callback returns true
  getter/setter pairinherited
- useHttpOnResponse → bool
- 
  Use HTTP on response
  finalinherited
- useInterceptors → bool
- 
  Use interceptors
  no setterinherited
Methods
- 
  delete<T> (String url, {Object? data, Options? options, CancelToken? cancelToken}) → Future< T?> 
- Make a DELETE request
- 
  displayError(DioException dioException, BuildContext context) → void 
- 
  Display a error to the user
This method is only called if you provide the API service
with a BuildContext.
  override
- 
  error(DioException dioException) → void 
- 
  Handle the DioExceptionresponse if there is an issue.inherited
- 
  get<T> (String url, {Object? data, Map< String, String> ? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onReceiveProgress}) → Future<T?> 
- Make a GET request
- 
  getContext() → BuildContext? 
- 
  Get the build context
  inherited
- 
  handleResponse<T> (Response response, {dynamic handleSuccess(Response response)?}) → dynamic 
- 
  Handles an API network response from Dio.handleSuccessoverrides the return valuehandleFailureis called then the response status is not 200. You can return a different value using this callback.inherited
- 
  init() → void 
- 
  Initialize class
  inherited
- 
  network<T> ({required dynamic request(Dio api), dynamic handleSuccess(Response response)?, dynamic handleFailure(DioException error)?, String? bearerToken, String? baseUrl, bool useUndefinedResponse = true, bool shouldRetry = true, bool? shouldSetAuthHeaders, int? retry, Duration? retryDelay, bool retryIf(DioException dioException)?, Duration? connectionTimeout, Duration? receiveTimeout, Duration? sendTimeout, Duration? cacheDuration, String? cacheKey, Map< String, dynamic> ? headers}) → Future<T?> 
- 
  Networking class to handle API requests
Use the requestcallback to call an APIhandleSuccessoverrides the response on a successful status codehandleFailureoverrides the response on a failureinherited
- 
  noSuchMethod(Invocation invocation) → dynamic 
- 
  Invoked when a nonexistent method or property is accessed.
  inherited
- 
  onError(dynamic onError(DioException dioException)) → void 
- 
  Set the onErrorcallback for the requestinherited
- 
  onSuccess(dynamic onSuccess(Response response, dynamic data)) → void 
- 
  Set the onSuccesscallback for the requestinherited
- 
  onUndefinedResponse(dynamic data, Response response, BuildContext? context) → void 
- 
  Handle the undefined response's for HTTP requests.
The dataparameter contains what was returned from your decoder.inherited
- 
  post<T> (String url, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future< T?> 
- Make a POST request
- 
  put<T> (String url, {Object? data, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress}) → Future< T?> 
- Make a PUT request
- 
  refreshToken(Dio dio) → Future< void> 
- 
  Perform a Diorequest to update the users auth token. This method is called when shouldRefreshToken returns true. You can override this method to perform your own request. Thedioparameter is a new instance ofDio. You can use this to perform a request without affecting the originalDioinstance.inherited
- 
  setAuthHeaders(RequestHeaders headers) → Future< RequestHeaders> 
- 
  Set the auth headers for the request.
The headersparameter contains the current headers.inherited
- 
  setBaseUrl(String baseUrl) → void 
- 
  Set a baseUrlfor the request.inherited
- 
  setBearerToken(String bearerToken) → void 
- 
  Set a bearer token headersto the baseOptions variable.inherited
- 
  setCache(Duration? duration, String cacheKey) → void 
- 
  Set the cache for the request.
  inherited
- 
  setConnectTimeout(Duration duration) → void 
- 
  Set the connectTimeoutfor the request.inherited
- 
  setContentType(String contentType) → void 
- 
  Set the contentTypefor the request.inherited
- 
  setContext(BuildContext context) → void 
- 
  Set the build context (optional)
  inherited
- 
  setHeaders(Map< String, dynamic> headers) → void
- 
  Set new headersto the baseOptions variable.inherited
- 
  setMethod(String method) → void 
- 
  Set the methodfor the request.inherited
- 
  setOptions(BaseOptions baseOptions) → void 
- 
  Set the baseOptionsfor the request.inherited
- 
  setPagination(int page, {String? paramPage, String? paramPerPage, String? perPage}) → void 
- 
  Apply a pagination query to the HTTP request
  inherited
- 
  setReceiveTimeout(Duration duration) → void 
- 
  Set the receiveTimeoutfor the request.inherited
- 
  setRetry(int retry) → void 
- 
  Set how many times the request should retryif it fails.inherited
- 
  setRetryDelay(Duration retryDelay) → void 
- 
  Set the Duration how long the request should wait before retrying.
  inherited
- 
  setRetryIf(bool retryIf(DioException dioException)) → void 
- 
  Set if the request should shouldRetryif theretryIfreturns true.inherited
- 
  setSendTimeout(Duration duration) → void 
- 
  Set the sendTimeoutfor the request.inherited
- 
  setShouldSetAuthHeaders(bool shouldSetAuthHeaders) → void 
- 
  Set if the request should shouldSetAuthHeadersif the shouldRefreshToken returns true.inherited
- 
  shouldRefreshToken() → Future< bool> 
- 
  Check if the users auth token should be refreshed.
This method is called before every request.
You can override this method to perform your own checks.
  inherited
- 
  toString() → String 
- 
  A string representation of this object.
  inherited
Operators
- 
  operator ==(Object other) → bool 
- 
  The equality operator.
  inherited