SimplePip constructor

SimplePip({
  1. VoidCallback? onPipEntered,
  2. VoidCallback? onPipExited,
  3. dynamic onPipAction(
    1. PipAction
    )?,
})

Implementation

SimplePip({this.onPipEntered, this.onPipExited, this.onPipAction}) {
  if (onPipEntered != null || onPipExited != null || onPipAction != null) {
    _channel.setMethodCallHandler(
      (call) async {
        switch (call.method) {
          case 'onPipEntered':
            onPipEntered?.call();
            break;
          case 'onPipExited':
            onPipExited?.call();
            break;
          case 'onPipAction':
            String arg = call.arguments;
            PipAction action =
                PipAction.values.firstWhere((e) => e.name == arg);
            onPipAction?.call(action);
            break;
        }
      },
    );
  }
}