NetworkManager class

Constructors

NetworkManager.instance({required BuildContext context, required String api, dynamic req, Map<String, dynamic>? query, void onSuccess(BuildContext? context, NMResponse result)?, void onFailed(BuildContext? context, NMResponse result)?, Function? onStart, Function? onEnd, Duration? timeout, CancelToken? cancelToken, Map<String, dynamic>? headers, bool showFailedDialog = true, bool callDefaults = true, bool followRedirect = true, bool validStatus(int?)?, bool showSuccessDialog = false, bool forbidCancelWhenOffline = false})
factory

Properties

api String?
api address you're requesting
getter/setter pair
callDefaults bool?
check to call default functions each step
getter/setter pair
cancelToken ↔ CancelToken?
getter/setter pair
context BuildContext?
need context to show dialog or pop and push
getter/setter pair
dio ↔ Dio?
dio instance for making requests
getter/setter pair
dioOption ↔ BaseOptions
getter/setter pair
errorMsgExtractor ↔ (String Function(dynamic error)?)
a function to extract error as string
getter/setter pair
failedDialog ↔ (Future Function(BuildContext? context, String title, String body)?)
getter/setter pair
forbidCancelWhenOffline bool
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
onEnd Function?
called on end this instance of Network Manager request
getter/setter pair
onEndDefault Function?
called on End every request
getter/setter pair
onFailed ↔ dynamic Function(BuildContext? context, NMResponse responseJson)
called on failed this instance of Network Manager request
getter/setter pair
onFailedDefault Function?
called on Failed every request
getter/setter pair
onStart Function?
called on start this instance of Network Manager request
getter/setter pair
onStartDefault Function?
getter/setter pair
onSuccess ↔ void Function(BuildContext? context, NMResponse responseJson)
called on success this instance of Network Manager request
getter/setter pair
onSuccessDefault Function?
called on Success every request
getter/setter pair
onTokenExpire ↔ (void Function(void retryFunctoin())?)
called on token expire
getter/setter pair
query Map<String, dynamic>?
Map
getter/setter pair
req ↔ dynamic
dynamic request data for post methods
getter/setter pair
requestGet → dynamic
no setter
requestPost → dynamic
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showFailedDialog bool?
check to show dialog when when request is success
getter/setter pair
showSuccessDialog bool?
check to show dialog when when request is failed
getter/setter pair
successDialog ↔ (Future Function(BuildContext? context, String title, String body)?)
getter/setter pair
successMsgExtractor ↔ (String Function(dynamic msg)?)
getter/setter pair
successRules ↔ (bool Function(dynamic responseJson)?)
other rules for check beside result code 200 should be a function return bool value
getter/setter pair
token String?
String token which is used in header
getter/setter pair
tokenExpireRules ↔ (bool Function(dynamic responseJson)?)
conditions where token expires
getter/setter pair
useFancyDialog bool?
getter/setter pair

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