invoke<T> method

Future<T?> invoke<T>(
  1. String method, [
  2. Map<String, dynamic>? args
])

Invoke a native method with playerId auto-injected.

  • method native method name, same as the original Pigeon API (e.g. startVodPlay / pause).
  • args business parameters. Omit when none.

The native side returns primitive types directly (bool / int / String / Map / List) instead of wrapped XxxMsg.

Implementation

Future<T?> invoke<T>(String method, [Map<String, dynamic>? args]) {
  final Map<String, dynamic> payload = <String, dynamic>{
    'playerId': playerId,
    if (args != null) ...args,
  };
  return _channel.invokeMethod<T>(method, payload);
}