addUserFace method

  1. @override
void addUserFace(
  1. int startTime,
  2. int endTime,
  3. BleDeviceCall<String> call, {
  4. String? nickname,
})
override

Implementation

@override
void addUserFace(int startTime, int endTime, BleDeviceCall<String> call,
    {String? nickname}) {
  _channel.setMethodCallHandler(null);
  _channel.setMethodCallHandler((channelCall) {
    if (channelCall.method == "addUserFaceProgress") {
      if (call.faceProgress != null) {
        call.faceProgress!(
            channelCall.arguments["overall"],
            channelCall.arguments["current"],
            FaceActionList.fruitFromString(channelCall.arguments["action"]));
      }
    }
    return Future.value(null);
  });
  _channel.invokeMethod<String>("addUserFace", {
    "startTime": startTime,
    "endTime": endTime,
    "nickname": nickname
  }).then((uid) {
    _channel.setMethodCallHandler(null);
    call.success(uid!);
  }).onError((PlatformException error, stackTrace) {
    _channel.setMethodCallHandler(null);
    call.fail(error);
  });
}