registerWith static method

void registerWith(
  1. Registrar registrar
)

Registers the channel handler with the web engine.

Implementation

static void registerWith(Registrar registrar) {
  // Pass the registrar as the messenger: the binding is not initialized
  // during engine-init plugin registration, and Registrar IS a
  // BinaryMessenger, so no ServicesBinding lookup happens here.
  final channel = MethodChannel(
    'native_adaptive_toolbox/menu',
    StandardMethodCodec(),
    registrar,
  );
  channel.setMethodCallHandler((call) async {
    switch (call.method) {
      case 'showMenu':
        return false;
      case 'dismissMenu':
        return null;
      default:
        return null;
    }
  });
}