@@ -30,12 +30,18 @@ import 'src/models/config/ck_configuration.dart';
3030import 'src/platform_interface/web_callkit_platform_interface.dart' ;
3131import 'src/utils/utils.dart' ;
3232
33+ export 'src/src.dart' ;
34+
3335/// A web implementation of the WebCallkitPlatform of the WebCallkit plugin.
3436class WebCallkitWeb extends WebCallkitPlatform {
3537 static const tag = 'web_callkit' ;
3638
39+ static final WebCallkitWeb _instance = WebCallkitWeb ._internal ();
40+
41+ static WebCallkitWeb get instance => _instance;
42+
3743 static void registerWith (Registrar registrar) {
38- WebCallkitPlatform .instance = WebCallkitWeb ();
44+ WebCallkitPlatform .instance = WebCallkitWeb . _internal ();
3945 }
4046
4147 final Map <String , CallTimer > _timers = {};
@@ -55,22 +61,23 @@ class WebCallkitWeb extends WebCallkitPlatform {
5561 OnCallTypeChangeListener ? _onCallTypeChangeListener;
5662 OnDismissedListener ? _onDismissedListener;
5763
58- CKConfiguration _configuration;
64+ late CKConfiguration _configuration;
5965 final Map <String , bool > _defaultFlags = {
6066 NotificationManager .CK_EXTRA_PERSIST : true ,
6167 };
6268
6369 /// The method channel used to interact with the native platform.
6470 // @visibleForTesting
6571 // final methodChannel = const MethodChannel('web_callkit');
72+ factory WebCallkitWeb () {
73+ return _instance;
74+ }
75+
76+ WebCallkitWeb ._internal () {
77+ _callManager = CallManager ();
78+ _notificationManager = NotificationManagerImplWeb ();
79+ _configuration = WebCallkitPlatform .defaultConfiguration;
6680
67- WebCallkitWeb ({
68- CKConfiguration ? configuration,
69- }) : /*_audioManager = audioManager ?? AudioManager(),*/
70- _callManager = CallManager (),
71- _notificationManager = NotificationManagerImplWeb (),
72- _configuration = configuration ?? WebCallkitPlatform .defaultConfiguration,
73- super () {
7481 _setupNotificationEventListeners ();
7582 _callManager.setOnCallUpdate (_onCallUpdated);
7683 }
0 commit comments