agent/agent/index library

Mixins

WithToJson

Constants

btoa → const String Function(dynamic value)
defaultExpireInDuration → const Duration
defaultExpireInMinutes → const int
Most of the timeouts will happen in 5 minutes.
defaultHttpAgentOption → const DefaultHttpAgentOption
defaultTimeout → const Duration

Functions

defaultFetch({required String endpoint, String? host, String? defaultHost, FetchMethod method = FetchMethod.post, Map<String, String>? baseHeaders, Map<String, String>? headers, Duration? timeout = defaultTimeout, bool cbor = true, dynamic body}) Future<Map<String, dynamic>>
defaultFetch is a wrapper of http.get, which can be replaced by any other http packages (e.g. dio). http has embedded by default, so the library use it directly. Users can set host should be full path of http/https. Usually the usage could be defaultHost+endpoint and set the defaultHost to somewhere final, then change the endpoint programmatically. defaultTimeout is the default timeout limit, and throw error directly to end the request section.
makeNonceTransform([NonceFunc nonceFn = makeNonce]) HttpAgentRequestTransformFnCall
withRetry<T>(FutureOr<T> action(), {int retryTimes = 3, int retryIntervalMills = 500}) Future<T>

Typedefs

Envelope<T> = UnSigned<T>
FetchFunction<T> = Future<T> Function({dynamic body, required String endpoint, Map<String, String>? headers, String? host, FetchMethod method})
HttpAgentRequest = HttpAgentBaseRequest<WithToJson>
HttpAgentRequestTransformFnCall = Future<HttpAgentRequest?> Function(HttpAgentRequest args)
NonceFunc = Nonce Function()
ReadRequest = ReadStateRequest