title: Facebook App Events not working in Flutter
body: <p>I have a flutter application where my task is to log user events using facebook app events. I have added the following package to my pubspec.yaml:</p>
  <pre><code>facebook_app_events: ^0.14.7
  </code></pre>
  <p>Added the following in build.gradle:</p>
  <pre><code>buildscript {
      ext.kotlin_version = '1.5.10'
      repositories {
          google()
          jcenter()
          mavenCentral() //**Added as per fb docs
      }
  </code></pre>
  <p>Added the following to app/build.gradle:</p>
  <pre><code>dependencies {
      implementation 'com.facebook.android:facebook-android-sdk:latest.release'
  
  }
  </code></pre>
  <p>In AndroidManifest, I've added the following meta-data:</p>
  <pre><code>&lt;application
      ..//
          &lt;meta-data android:name=&quot;com.facebook.sdk.ApplicationId&quot;
              android:value=&quot;app id&quot;/&gt;
       
  
      &lt;/application&gt;
  </code></pre>
  <p>Later, in my flutter views I did the following implementation:</p>
  <pre><code>static final facebookSDK = FacebookAppEvents();
  
  TextButton(
                            onPressed: () {
                              facebookSDK.logEvent(
                                name: 'button_clicked',
                                parameters: {
                                  'button_id': 'the_clickme_button',
                                },
                              );
                            },
                            child: Text(&quot;Trigger Payment Info Click&quot;)),
  </code></pre>
  <p>When I click this button, I get the following error instead of sending the logEvent to fb:</p>
  <pre><code>E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475): Failed to handle method call
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475): kotlin.UninitializedPropertyAccessException: lateinit property appEventsLogger has not been initialized
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at id.oddbit.flutter.facebook_app_events.FacebookAppEventsPlugin.handleLogEvent(FacebookAppEventsPlugin.kt:99)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at id.oddbit.flutter.facebook_app_events.FacebookAppEventsPlugin.onMethodCall(FacebookAppEventsPlugin.kt:48)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at android.os.MessageQueue.nativePollOnce(Native Method)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at android.os.MessageQueue.next(MessageQueue.java:336)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at android.os.Looper.loop(Looper.java:174)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at android.app.ActivityThread.main(ActivityThread.java:7438)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at java.lang.reflect.Method.invoke(Native Method)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
  E/MethodChannel#flutter.oddbit.id/facebook_app_events(32475):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:989)
  E/flutter (32475): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, lateinit property appEventsLogger has not been initialized, null, kotlin.UninitializedPropertyAccessException: lateinit property appEventsLogger has not been initialized
  E/flutter (32475):  at id.oddbit.flutter.facebook_app_events.FacebookAppEventsPlugin.handleLogEvent(FacebookAppEventsPlugin.kt:99)
  E/flutter (32475):  at id.oddbit.flutter.facebook_app_events.FacebookAppEventsPlugin.onMethodCall(FacebookAppEventsPlugin.kt:48)
  E/flutter (32475):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
  E/flutter (32475):  at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
  E/flutter (32475):  at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
  E/flutter (32475):  at android.os.MessageQueue.nativePollOnce(Native Method)
  E/flutter (32475):  at android.os.MessageQueue.next(MessageQueue.java:336)
  E/flutter (32475):  at android.os.Looper.loop(Looper.java:174)
  E/flutter (32475):  at android.app.ActivityThread.main(ActivityThread.java:7438)
  E/flutter (32475):  at java.lang.reflect.Method.invoke(Native Method)
  E/flutter (32475):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
  E/flutter (32475):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:989)
  E/flutter (32475): )
  E/flutter (32475): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
  E/flutter (32475): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
  E/flutter (32475): &lt;asynchronous suspension&gt;
  </code></pre>
  <p>I deleted .gradle folder, ran flutter clean still no help. I do not know much about native kotlin. Any sort of help will be appreciated.</p>