HttpAgent class

Implemented types

Constructors

HttpAgent({HttpAgentOptions? options, String defaultProtocol = 'https', String defaultHost = 'localhost', String defaultPort = ':8000'})

Properties

defaultHost String
getter/setter pair
defaultPort String
getter/setter pair
defaultProtocol String
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
rootKey BinaryBlob?
getter/setter pairoverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addTransform(HttpAgentRequestTransformFn fn, [int? priority]) → void
call(Principal canisterId, CallOptions fields, Identity? identity) Future<SubmitResponse>
override
fetchRootKey() Future<BinaryBlob>
By default, the agent is configured to talk to the main Internet Computer, and verifies responses using a hard-coded public key.
override
getPrincipal() Future<Principal>
Returns the principal ID associated with this agent (by default). It only shows the principal of the default identity in the agent, which is the principal used when calls don't specify it.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query(Principal canisterId, QueryFields options, Identity? identity) Future<QueryResponse>
Send a query call to a canister. See {@link https://sdk.dfinity.org/docs/interface-spec/#http-query | the interface spec}. @param canisterId The Principal of the Canister to send the query to. Sending a query to the management canister is not supported (as it has no meaning from an agent). @param options Options to use to create and send the query. @returns The response from the replica. The Promise will only reject when the communication failed. If the query itself failed but no protocol errors happened, the response will be of type QueryResponseRejected.
override
readState(Principal canisterId, ReadStateOptions fields, Identity? identity) Future<ReadStateResponse>
Send a read state query to the replica. This includes a list of paths to return, and will return a Certificate. This will only reject on communication errors, but the certificate might contain less information than requested. @param effectiveCanisterId A Canister ID related to this call. @param options The options for this call.
override
setCredentials(String? cred) → void
setFetch(FetchFunc<Map<String, dynamic>>? fetch) → void
setHost(String? host) → void
setIdentity(Future<Identity>? id) → void
setPipeline(List<HttpAgentRequestTransformFn> pl) → void
status() Future<Map>
Query the status endpoint of the replica. This normally has a few fields that corresponds to the version of the replica, its root public key, and any other information made public. @returns A JsonObject that is essentially a record of fields from the status endpoint.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited