ソースを参照

优化初始化回调

RandyWei 5 年 前
コミット
d1cd326927

+ 19 - 9
.idea/workspace.xml

@@ -24,7 +24,13 @@
   <component name="ChangeListManager">
     <list default="true" id="7945bc75-c964-46e8-bae6-c93a89a0a56f" name="Default Changelist" comment="更新百度人脸SDK">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/FaceLivenessExpActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/FaceLivenessExpActivity.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/dev/bughub/plugin/fltbdface/FltbdfacePlugin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/dev/bughub/plugin/fltbdface/FltbdfacePlugin.kt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/BdFaceLivenessActivity.kt" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/FaceDelegate.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/FaceDelegate.kt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/FacePlugin.kt" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/example/lib/face_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/face_service.dart" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/lib/face/face_plugin.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/face/face_plugin.dart" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/test/fltbdface_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/fltbdface_test.dart" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -202,29 +208,33 @@
     <option name="LAST_COMMIT_MESSAGE" value="更新百度人脸SDK" />
   </component>
   <component name="WindowStateProjectService">
-    <state width="1878" height="609" key="GridCell.Tab.0.bottom" timestamp="1605666753813">
+    <state x="760" y="271" key="AndroidProcessChooserDialog" timestamp="1605763330779">
+      <screen x="0" y="25" width="1920" height="992" />
+    </state>
+    <state x="760" y="271" key="AndroidProcessChooserDialog/0.25.1920.992@0.25.1920.992" timestamp="1605763330779" />
+    <state width="1878" height="488" key="GridCell.Tab.0.bottom" timestamp="1605763748109">
       <screen x="0" y="25" width="1920" height="992" />
     </state>
     <state width="1878" height="619" key="GridCell.Tab.0.bottom/0.23.1920.1000@0.23.1920.1000" timestamp="1605573761281" />
     <state width="1878" height="620" key="GridCell.Tab.0.bottom/0.23.1920.1001@0.23.1920.1001" timestamp="1605259102878" />
-    <state width="1878" height="609" key="GridCell.Tab.0.bottom/0.25.1920.992@0.25.1920.992" timestamp="1605666753813" />
-    <state width="1878" height="609" key="GridCell.Tab.0.center" timestamp="1605666753812">
+    <state width="1878" height="488" key="GridCell.Tab.0.bottom/0.25.1920.992@0.25.1920.992" timestamp="1605763748109" />
+    <state width="1878" height="488" key="GridCell.Tab.0.center" timestamp="1605763748108">
       <screen x="0" y="25" width="1920" height="992" />
     </state>
     <state width="1878" height="619" key="GridCell.Tab.0.center/0.23.1920.1000@0.23.1920.1000" timestamp="1605573761280" />
     <state width="1878" height="620" key="GridCell.Tab.0.center/0.23.1920.1001@0.23.1920.1001" timestamp="1605259102877" />
-    <state width="1878" height="609" key="GridCell.Tab.0.center/0.25.1920.992@0.25.1920.992" timestamp="1605666753812" />
-    <state width="1878" height="609" key="GridCell.Tab.0.left" timestamp="1605666753812">
+    <state width="1878" height="488" key="GridCell.Tab.0.center/0.25.1920.992@0.25.1920.992" timestamp="1605763748108" />
+    <state width="1878" height="488" key="GridCell.Tab.0.left" timestamp="1605763748108">
       <screen x="0" y="25" width="1920" height="992" />
     </state>
     <state width="1878" height="619" key="GridCell.Tab.0.left/0.23.1920.1000@0.23.1920.1000" timestamp="1605573761280" />
     <state width="1878" height="620" key="GridCell.Tab.0.left/0.23.1920.1001@0.23.1920.1001" timestamp="1605259102877" />
-    <state width="1878" height="609" key="GridCell.Tab.0.left/0.25.1920.992@0.25.1920.992" timestamp="1605666753812" />
-    <state width="1878" height="609" key="GridCell.Tab.0.right" timestamp="1605666753812">
+    <state width="1878" height="488" key="GridCell.Tab.0.left/0.25.1920.992@0.25.1920.992" timestamp="1605763748108" />
+    <state width="1878" height="488" key="GridCell.Tab.0.right" timestamp="1605763748108">
       <screen x="0" y="25" width="1920" height="992" />
     </state>
     <state width="1878" height="619" key="GridCell.Tab.0.right/0.23.1920.1000@0.23.1920.1000" timestamp="1605573761280" />
     <state width="1878" height="620" key="GridCell.Tab.0.right/0.23.1920.1001@0.23.1920.1001" timestamp="1605259102877" />
-    <state width="1878" height="609" key="GridCell.Tab.0.right/0.25.1920.992@0.25.1920.992" timestamp="1605666753812" />
+    <state width="1878" height="488" key="GridCell.Tab.0.right/0.25.1920.992@0.25.1920.992" timestamp="1605763748108" />
   </component>
 </project>

+ 2 - 2
android/src/main/kotlin/dev/bughub/plugin/fltbdface/FltbdfacePlugin.kt

@@ -102,7 +102,7 @@ public class FltbdfacePlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
                 result.success(null)
             }
             "startFaceLiveness" -> {
-                flutterBinding?.binaryMessenger?.let { delegate?.startFaceLiveness(it) }
+                delegate?.startFaceLiveness()
                 result.success(null)
             }
         }
@@ -125,7 +125,7 @@ public class FltbdfacePlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
             activityBinding: ActivityPluginBinding?) {
         this.activity = activity
         this.application = application
-        delegate = FaceDelegate(activity)
+        delegate = FaceDelegate(activity, flutterBinding?.binaryMessenger)
         channel = MethodChannel(messenger, CHANNEL)
         channel?.setMethodCallHandler(this)
         if (registrar != null) { // V1 embedding setup for activity listeners.

+ 0 - 97
android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/BdFaceLivenessActivity.kt

@@ -1,97 +0,0 @@
-package dev.bughub.plugin.fltbdface.face
-
-import android.Manifest
-import android.annotation.TargetApi
-import android.content.Intent
-import android.content.pm.PackageManager
-import android.os.Build
-import android.os.Bundle
-import android.widget.Toast
-import com.baidu.idl.face.platform.ui.FaceLivenessActivity
-import java.util.*
-
-//
-//class BdFaceLivenessActivity : FaceLivenessActivity() {
-//    override fun onCreate(savedInstanceState: Bundle?) {
-//        super.onCreate(savedInstanceState)
-//        requestPermissions(99, Manifest.permission.CAMERA)
-//        //人脸检测的活体动作
-//    }
-//
-//    override fun onLivenessCompletion(status: FaceStatusEnum, message: String, base64ImageMap: HashMap<String, String>?) {
-//        super.onLivenessCompletion(status, message, base64ImageMap)
-//        if (status == FaceStatusEnum.OK && mIsCompletion) {
-//            base64ImageMap?.let { baseImages ->
-//                baseImages["bestImage0"]?.let {
-//                    val data = Intent()
-//                    data.putExtra("data", it)
-//                    setResult(10001, data)
-//                    finish()
-////                    ApiBdFace().doFaceMatch(loginName, it, object : Network.OnResponseBaseListener {
-////                        override fun onSuccess() {
-////                            isFaceLived = true
-////                            isFaceLivedBack = false
-////                            toastResult.text = "人脸识别成功"
-////                            Handler().postDelayed({ finish() }, 2000)
-////                            setResult(Activity.RESULT_OK)
-////                        }
-////
-////                        override fun onFailure(status: Int, message: String?) {
-////                            isFaceLived = false
-////                            isFaceLivedBack = true
-////                            toastResult.text = "人脸识别失败$message"
-////                            Handler().postDelayed({ finish() }, 3000)
-////                        }
-////
-////                        override fun onError(message: String?) {
-////                            isFaceLived = false
-////                            isFaceLivedBack = true
-////                            toastResult.text = "人脸识别失败$message"
-////                            Handler().postDelayed({ finish() }, 3000)
-////                        }
-////                    })
-//                }
-//            }
-//
-//        } else if (status == FaceStatusEnum.Error_DetectTimeout ||
-//                status == FaceStatusEnum.Error_LivenessTimeout ||
-//                status == FaceStatusEnum.Error_Timeout) {
-//            Toast.makeText(this, "采集超时", Toast.LENGTH_LONG).show()
-//        }
-//    }
-//
-//    private fun requestPermissions(requestCode: Int, permission: String?) {
-//        if (permission != null && permission.isNotEmpty()) {
-//            try {
-//                if (Build.VERSION.SDK_INT >= 23) {
-//                    // 检查是否有权限
-//                    val hasPer = checkSelfPermission(permission)
-//                    if (hasPer != PackageManager.PERMISSION_GRANTED) {
-//                        // 是否应该显示权限请求
-//                        // val isShould = shouldShowRequestPermissionRationale(permission)
-//                        requestPermissions(arrayOf(permission), requestCode)
-//                    }
-//                } else {
-//
-//                }
-//            } catch (ex: Exception) {
-//                ex.printStackTrace()
-//            }
-//
-//        }
-//    }
-//
-//    @TargetApi(Build.VERSION_CODES.M)
-//    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>,
-//                                            grantResults: IntArray) {
-//        var flag = false
-//        for (i in permissions.indices) {
-//            if (PackageManager.PERMISSION_GRANTED == grantResults[i]) {
-//                flag = true
-//            }
-//        }
-//        if (!flag) {
-//            requestPermissions(99, Manifest.permission.CAMERA)
-//        }
-//    }
-//}

+ 37 - 40
android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/FaceDelegate.kt

@@ -15,48 +15,45 @@ import io.flutter.plugin.common.BinaryMessenger
 import io.flutter.plugin.common.EventChannel
 import io.flutter.plugin.common.PluginRegistry
 import java.util.*
+import kotlin.collections.HashMap
 
 
-class FaceDelegate(var activity: Activity) : PluginRegistry.ActivityResultListener, PluginRegistry.RequestPermissionsResultListener {
+class FaceDelegate(var activity: Activity, var binaryMessenger: BinaryMessenger?) : PluginRegistry.ActivityResultListener, PluginRegistry.RequestPermissionsResultListener {
 
     val REQUEST_CAMERA_VIDEO_PERMISSION = 2355
     val FACE_LIVENESS_REQUEST_CODE = 123
-    var permissionManager: PermissionManager? = null
     private val eventSink = QueuingEventSink()
+    private val initEventSink = QueuingEventSink()
 
+    fun initialize(licenseId: String, licenseFileName: String) {
 
-//    init {
-//        permissionManager = object: PermissionManager{
-//            override fun isPermissionGranted(permissionName: String?): Boolean {
-//                return permissionName?.let { ActivityCompat.checkSelfPermission(activity, it) } == PackageManager.PERMISSION_GRANTED
-//            }
-//
-//            override fun askForPermission(permissionName: String?, requestCode: Int) {
-//                ActivityCompat.requestPermissions(activity, arrayOf(permissionName!!), requestCode)
-//            }
-//
-//            override fun needRequestCameraPermission(): Boolean {
-//                val greatOrEqualM = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
-//                return greatOrEqualM && isPermissionPresentInManifest(activity, Manifest.permission.CAMERA)
-//            }
-//
-//        }
-//    }
+        EventChannel(binaryMessenger, "plugin.bughub.dev/event:init").setStreamHandler(object : EventChannel.StreamHandler {
+            override fun onListen(o: Any?, sink: EventChannel.EventSink?) {
+                // 把eventSink存起来
+                initEventSink.setDelegate(sink)
+            }
 
-//    private fun needRequestCameraPermission(): Boolean {
-//        return if (permissionManager == null) {
-//            false
-//        } else permissionManager!!.needRequestCameraPermission()
-//    }
+            override fun onCancel(o: Any?) {
+                initEventSink.setDelegate(null)
+            }
+        })
 
-    fun initialize(licenseId: String, licenseFileName: String) {
-        FaceSDKManager.getInstance().initialize(activity, licenseId, licenseFileName,object :IInitCallback{
+        FaceSDKManager.getInstance().initialize(activity, licenseId, licenseFileName, object : IInitCallback {
             override fun initSuccess() {
-                Log.i("FaceDelegate","初始化成功")
+                Log.i("FaceDelegate", "初始化成功")
+                activity.runOnUiThread {
+                    val map = HashMap<String, Any>()
+                    map["status"] = 0
+                    map["message"] = "成功"
+                    initEventSink.success(map)
+                }
             }
 
             override fun initFailure(status: Int, message: String?) {
-                Log.e("FaceDelegate","$status  -----   $message")
+                Log.e("FaceDelegate", "$status  -----   $message")
+                activity.runOnUiThread {
+                    initEventSink.error("$status", "$message", "")
+                }
             }
 
         })
@@ -134,9 +131,9 @@ class FaceDelegate(var activity: Activity) : PluginRegistry.ActivityResultListen
         FaceSDKManager.getInstance().faceConfig = config
     }
 
-    fun startFaceLiveness(messenger: BinaryMessenger) {
+    fun startFaceLiveness() {
 
-        EventChannel(messenger, "plugin.bughub.dev/event").setStreamHandler(object : EventChannel.StreamHandler {
+        EventChannel(binaryMessenger, "plugin.bughub.dev/event").setStreamHandler(object : EventChannel.StreamHandler {
             override fun onListen(o: Any?, sink: EventChannel.EventSink?) {
                 // 把eventSink存起来
                 eventSink.setDelegate(sink)
@@ -210,17 +207,17 @@ class FaceDelegate(var activity: Activity) : PluginRegistry.ActivityResultListen
 //        FaceSDKManager.getInstance().initialize(activity, "pharmacist-license-face-android", "idl-license.face-android")
         val config = FaceSDKManager.getInstance().faceConfig
         // SDK初始化已经设置完默认参数(推荐参数),您也根据实际需求进行数值调整
-        config.setLivenessTypeList(getRandomActions(actionNum))
-        config.setLivenessRandom(isLivenessRandom)
-        config.setBlurnessValue(FaceEnvironment.VALUE_BLURNESS)
-        config.setBrightnessValue(FaceEnvironment.VALUE_BRIGHTNESS)
+        config.livenessTypeList = getRandomActions(actionNum)
+        config.isLivenessRandom = isLivenessRandom
+        config.blurnessValue = FaceEnvironment.VALUE_BLURNESS
+        config.brightnessValue = FaceEnvironment.VALUE_BRIGHTNESS
 //        config.setCropFaceValue(FaceEnvironment.VALUE_CROP_FACE_SIZE)
-        config.setHeadPitchValue(FaceEnvironment.VALUE_HEAD_PITCH)
-        config.setHeadRollValue(FaceEnvironment.VALUE_HEAD_ROLL)
-        config.setHeadYawValue(FaceEnvironment.VALUE_HEAD_YAW)
-        config.setMinFaceSize(FaceEnvironment.VALUE_MIN_FACE_SIZE)
-        config.setNotFaceValue(FaceEnvironment.VALUE_NOT_FACE_THRESHOLD)
-        config.setOcclusionValue(FaceEnvironment.VALUE_OCCLUSION)
+        config.headPitchValue = FaceEnvironment.VALUE_HEAD_PITCH
+        config.headRollValue = FaceEnvironment.VALUE_HEAD_ROLL
+        config.headYawValue = FaceEnvironment.VALUE_HEAD_YAW
+        config.minFaceSize = FaceEnvironment.VALUE_MIN_FACE_SIZE
+        config.notFaceValue = FaceEnvironment.VALUE_NOT_FACE_THRESHOLD
+        config.occlusionValue = FaceEnvironment.VALUE_OCCLUSION
 //        config.setCheckFaceQuality(true)
 //        config.setFaceDecodeNumberOfThreads(2)
 

+ 0 - 113
android/src/main/kotlin/dev/bughub/plugin/fltbdface/face/FacePlugin.kt

@@ -1,113 +0,0 @@
-package dev.bughub.plugin.fltbdface.face
-
-import android.app.Activity
-import io.flutter.embedding.engine.plugins.FlutterPlugin
-import io.flutter.embedding.engine.plugins.activity.ActivityAware
-import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
-import io.flutter.plugin.common.MethodCall
-import io.flutter.plugin.common.MethodChannel
-
-class FacePlugin:MethodChannel.MethodCallHandler,FlutterPlugin,ActivityAware{
-
-    private val CHANNEL_NAME = "com.chinahrt.app.pharmacist/face"
-
-    private var methodChannel: MethodChannel? = null
-    private var flutterBinding: FlutterPlugin.FlutterPluginBinding? = null
-    private var activityBinding:ActivityPluginBinding? = null
-    private var delegate: FaceDelegate? = null
-    private var activity:Activity? = null
-
-    override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
-        if (activity == null) {
-            result.error("no_activity", "image_picker plugin requires a foreground activity.", null)
-            return
-        }
-
-        when (call.method) {
-            "initialize" -> {
-                val licenseId = call.argument<String>("licenseId")?:""
-                val licenseFileName = call.argument<String>("licenseFileName")?:""
-                delegate?.initialize(licenseId,licenseFileName)
-                result.success(null)
-            }
-            "setFaceConfig" -> {
-                val livenessTypeList = call.argument<List<Int>>("livenessTypeList")?: arrayListOf()
-
-                val livenessRandom:Boolean = call.argument("isLivenessRandom")?:false
-
-                val blurnessValue:Float? = call.argument<Double>("blurnessValue")?.toFloat()
-
-                val brightnessValue:Float? = call.argument<Double>("brightnessValue")?.toFloat()
-
-                val cropFaceValue:Int? = call.argument<Int>("cropFaceValue")
-
-                val headPitchValue:Int? = call.argument<Int>("headPitchValue")
-                val headRollValue:Int? =call.argument<Int>("headRollValue")
-                val headYawValue:Int? =call.argument<Int>("headYawValue")
-                val minFaceSize:Int? =call.argument<Int>("minFaceSize")
-                val notFaceValue:Float? =call.argument<Double>("notFaceValue")?.toFloat()
-                val occlusionValue:Float? =call.argument<Double>("occlusionValue")?.toFloat()
-                val checkFaceQuality:Boolean? =call.argument<Boolean>("checkFaceQuality")
-                val faceDecodeNumberOfThreads:Int? =call.argument<Int>("faceDecodeNumberOfThreads")
-                val livenessRandomCount:Int? =call.argument<Int>("livenessRandomCount")
-
-
-                delegate?.setFaceConfig(livenessTypeList,livenessRandom=livenessRandom,blurnessValue=blurnessValue,brightnessValue=brightnessValue,
-                        cropFaceValue=cropFaceValue,headPitchValue=headPitchValue,headRollValue=headRollValue,headYawValue=headYawValue,minFaceSize=minFaceSize,
-                        notFaceValue=notFaceValue,occlusionValue=occlusionValue,checkFaceQuality=checkFaceQuality,faceDecodeNumberOfThreads=faceDecodeNumberOfThreads,livenessRandomCount=livenessRandomCount)
-
-                result.success(null)
-            }
-            "startFaceLiveness" -> {
-                flutterBinding?.binaryMessenger?.let { delegate?.startFaceLiveness(it) }
-                result.success(null)
-            }
-        }
-    }
-
-    override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
-        flutterBinding = binding
-    }
-
-    override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
-        flutterBinding = null
-    }
-
-    private fun tearDown(){
-
-        delegate?.let {
-            activityBinding?.removeActivityResultListener(it)
-            delegate = null
-            activityBinding = null
-        }
-
-        methodChannel?.setMethodCallHandler(null)
-        methodChannel = null
-    }
-
-    override fun onDetachedFromActivity() {
-        tearDown()
-    }
-
-    override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
-        onAttachedToActivity(binding)
-    }
-
-    override fun onAttachedToActivity(binding: ActivityPluginBinding) {
-
-        activityBinding = binding
-
-        methodChannel = MethodChannel(flutterBinding?.binaryMessenger, CHANNEL_NAME)
-        methodChannel?.setMethodCallHandler(this)
-
-        activity = binding.activity
-        delegate = FaceDelegate(binding.activity)
-        activityBinding?.addActivityResultListener(delegate!!)
-
-        activityBinding?.addRequestPermissionsResultListener(delegate!!)
-    }
-
-    override fun onDetachedFromActivityForConfigChanges() {
-        onDetachedFromActivity()
-    }
-}

+ 1 - 1
example/lib/face_service.dart

@@ -34,6 +34,6 @@ class FaceService {
     //设置配置
     _facePlugin.setFaceConfig(_faceConfig);
     //启动人脸采集界面
-    _facePlugin.startFaceLiveness(data: data, onFailed: onFailed);
+   _facePlugin.startFaceLiveness(data: data, onFailed: onFailed);
   }
 }

+ 26 - 6
lib/face/face_plugin.dart

@@ -5,26 +5,46 @@ import 'face_config.dart';
 class FacePlugin {
   MethodChannel _channel = MethodChannel("plugin.bughub.dev/fltbdface");
 
-  initialize({String licenseId, String licenseFileName}) {
-    _channel.invokeMethod("initialize",
-        {"licenseId": licenseId, "licenseFileName": licenseFileName}).catchError((error) {
+  initialize(
+      {String licenseId,
+      String licenseFileName,
+      Function onSuccess,
+      Function onFailed}) {
+
+    _channel.invokeMethod("initialize", {
+      "licenseId": licenseId,
+      "licenseFileName": licenseFileName
+    }).catchError((error) {
       print("initialize:$error");
     });
+    EventChannel("plugin.bughub.dev/event:init")
+        .receiveBroadcastStream()
+        .listen((value) {
+      print(value);
+      if (value['status'] == 0) {
+        onSuccess?.call();
+      }
+    }, onError: (error) {
+      onFailed?.call(error);
+    });
     return this;
   }
 
   setFaceConfig(FaceConfig _config) {
-    _channel.invokeMethod("setFaceConfig", _config.toJson()).catchError((error) {
+    _channel
+        .invokeMethod("setFaceConfig", _config.toJson())
+        .catchError((error) {
       print("setFaceConfig:$error");
     });
   }
 
-  startFaceLiveness({Function data,Function onFailed}) {
+  startFaceLiveness({Function data, Function onFailed}) {
     _channel.invokeMethod("startFaceLiveness").catchError((error) {
       print("startFaceLiveness:$error");
       onFailed.call(error);
     });
-    EventChannel("plugin.bughub.dev/event").receiveBroadcastStream().listen((value) {
+    EventChannel("plugin.bughub.dev/event").receiveBroadcastStream().listen(
+        (value) {
       data.call(value);
     }, onError: (error) {
       onFailed.call(error);

+ 1 - 3
test/fltbdface_test.dart

@@ -17,7 +17,5 @@ void main() {
     channel.setMockMethodCallHandler(null);
   });
 
-  test('getPlatformVersion', () async {
-    expect(await Fltbdface.platformVersion, '42');
-  });
+
 }