SimplePip constructor

SimplePip({
  1. VoidCallback? onPipEntered,
  2. VoidCallback? onPipExited,
  3. void 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();
        case 'onPipExited':
          onPipExited?.call();
        case 'onPipAction':
          String arg = call.arguments;
          PipAction action = PipAction.values.firstWhere(
            (e) => e.name == arg,
          );
          onPipAction?.call(action);
      }
    });
  }
}