Session constructor
Session({
- required String appId,
- @Deprecated("Use [token] or [tokenFetcher] instead") String? signature,
- String? token,
- TokenFetcherHandler? tokenFetcher,
- bool? enablePushNotifications = false,
- MessageHandler? onMessage,
- Unreads? unreads,
- UnreadsChangeHandler? onUnreadsChange,
Implementation
Session({
required this.appId,
@Deprecated("Use [token] or [tokenFetcher] instead") this.signature,
this.token,
this.tokenFetcher,
this.enablePushNotifications = false,
this.onMessage,
this.unreads,
this.onUnreadsChange,
}) : _completer = Completer() {
rootBundle
.loadString('packages/talkjs_flutter/assets/version.txt')
.then((version) {
_headlessWebView = HeadlessInAppWebView(
onWebViewCreated: _onWebViewCreated,
onLoadStop: _onLoadStop,
onConsoleMessage:
(InAppWebViewController controller, ConsoleMessage message) {
print("session [${message.messageLevel}] ${message.message}");
},
initialSettings: InAppWebViewSettings(
applicationNameForUserAgent:
'TalkJS_Flutter/${version.trim().replaceAll('"', '')}'));
// Runs the headless WebView
_headlessWebView!.run();
});
}