M10Directory constructor
M10Directory(
- String host, {
- TokenProvider? tokenProvider,
- bool disableTls = false,
- int port = 443,
Creates an M10Directory instance for interacting with the directory service.
Parameters:
host
(required): The hostname or IP address of the directory service.tokenProvider
(optional): A TokenProvider instance used to obtain access tokens for authorized operations. If not provided, operations requiring tokens will throw an exception.disableTls
(optional): A boolean flag indicating whether to disable TLS security for the connection. Defaults tofalse
(secure connection).port
(optional): The port number to connect to on the directory service host. Defaults to 443 for HTTPS connections.
Throws:
- An ArgumentError if an invalid port number is provided.
Implementation
M10Directory(
String host, {
TokenProvider? tokenProvider,
bool disableTls = false,
int port = 443,
}) : _tokenProvider = tokenProvider,
_client = DirectoryServiceClient(
ClientChannel(
host,
port: port,
options: ChannelOptions(
credentials: disableTls
? const ChannelCredentials.insecure()
: const ChannelCredentials.secure(),
),
),
);