Skip to main content

Api.create constructor

*[<Null safety>](https://dart.dev/null-safety)*

Api.create({String host = 'dev.xmtp.network', int port = 5556, bool isSecure = true, bool debugLogRequests = kDebugMode, String appVersion = "dev/0.0.0-development"})

Implementation

factory Api.create({
String host = 'dev.xmtp.network',
int port = 5556,
bool isSecure = true,
bool debugLogRequests = kDebugMode,
String appVersion = "dev/0.0.0-development",
}) {
var channel = grpc.ClientChannel(
host,
port: port,
options: grpc.ChannelOptions(
credentials: isSecure
? const grpc.ChannelCredentials.secure()
: const grpc.ChannelCredentials.insecure(),
userAgent: clientVersion,
),
);

return Api.createAdvanced(
channel,
options: grpc.CallOptions(
timeout: const Duration(minutes: 5),
// TODO: consider supporting compression
// compression: const grpc.GzipCodec(),
),
interceptors: debugLogRequests ? [_DebugLogInterceptor()] : [],
appVersion: appVersion,
);
}