OdooClient constructor
OdooClient(
- String baseURL, [
- OdooSession? sessionId,
- BaseClient? httpClient
Instantiates OdooClient with given Odoo server URL.
Optionally accepts sessionId to reuse existing session.
It is possible to pass own httpClient inherited
from http.BaseClient to override default one.
Implementation
OdooClient(String baseURL,
[OdooSession? sessionId, http.BaseClient? httpClient]) {
// Restore previous session
_sessionId = sessionId;
// Take or init HTTP client
this.httpClient = httpClient ?? http.Client() as http.BaseClient;
var baseUri = Uri.parse(baseURL);
// Take only scheme://host:port
this.baseURL = baseUri.origin;
_sessionStreamController = StreamController<OdooSession>.broadcast(
onListen: _startSessionSteam, onCancel: _stopSessionStream);
_loginStreamController = StreamController<OdooLoginEvent>.broadcast(
onListen: _startLoginSteam, onCancel: _stopLoginStream);
_inRequestStreamController = StreamController<bool>.broadcast(
onListen: _startInRequestSteam, onCancel: _stopInRequestStream);
}