MissingPluginException(No implementation found for method init on channel cometchat)

128 Views Asked by At

I get this error when try to initialization to cometchat on my flutter app

final String? cometChatAppId = dotenv.env['APP_ID'];
  final String? cometChatAppRegion = dotenv.env['APP_REGION'];
  final String? authKey = dotenv.env['COMETCHAT_AUTH_KEY'];

  if (cometChatAppId != null) {
    AppSettings appSettings = (AppSettingsBuilder()
          ..subscriptionType = CometChatSubscriptionType.allUsers
          ..region = cometChatAppRegion
          ..adminHost = "" 
          ..clientHost = "" 
          ..autoEstablishSocketConnection = true)
        .build();

    await CometChat.init(cometChatAppId, appSettings,
        onSuccess: (String successMessage) {
      debugPrint("Initialization completed successfully: $successMessage");
    }, onError: (CometChatException exception) {
      debugPrint("Initialization failed with exception: ${exception.message}");
    });
  }

error:

flutter: Error: MissingPluginException(No implementation found for method init on channel cometchat) flutter: Initialization failed with exception: MissingPluginException(No implementation found for method init on channel cometchat)

I need to connect my cometchat app

2

There are 2 best solutions below

0
On

Have you tried

  1. Upgrade Flutter (flutter -upgrade)
  2. Update all your plugins
  3. flutter clean
  4. flutter run

you can also delete the pods folder under io and try again

0
On

This is a common flutter error. You simply need to stop the application and run it again :)