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,
Implementation
Session({
required this.appId,
@Deprecated("Use [token] or [tokenFetcher] instead") this.signature,
this.token,
this.tokenFetcher,
this.enablePushNotifications = false,
this.onMessage,
this.unreads,
}) : _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();
});
}