dev
kt 31 lines 1.15 KB
Raw
1 package com.cakewallet.mweb
2
3 import androidx.annotation.NonNull
4
5 import io.flutter.embedding.engine.plugins.FlutterPlugin
6 import io.flutter.plugin.common.MethodCall
7 import io.flutter.plugin.common.MethodChannel
8 import io.flutter.plugin.common.MethodChannel.MethodCallHandler
9 import io.flutter.plugin.common.MethodChannel.Result
10
11 /** CwMwebPlugin */
12 class CwMwebPlugin: FlutterPlugin, MethodCallHandler {
13 /// The MethodChannel that will the communication between Flutter and native Android
14 ///
15 /// This local reference serves to register the plugin with the Flutter Engine and unregister it
16 /// when the Flutter Engine is detached from the Activity
17 private lateinit var channel : MethodChannel
18
19 override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
20 channel = MethodChannel(flutterPluginBinding.binaryMessenger, "cw_mweb")
21 channel.setMethodCallHandler(this)
22 }
23
24 override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
25 result.notImplemented()
26 }
27
28 override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
29 channel.setMethodCallHandler(null)
30 }
31 }