Registrar class

A registrar for Flutter plugins implemented in Dart.

Plugins for the web platform are implemented in Dart and are registered with this class by code generated by the flutter tool when compiling the application.

This class implements BinaryMessenger to route messages from the framework to registered plugins.

Use this BinaryMessenger when creating platform channels in order for them to receive messages from the platform side. For example:

class MyPlugin {
  static void registerWith(Registrar registrar) {
    final MethodChannel channel = MethodChannel(
      const StandardMethodCodec(),
      registrar, // the registrar is used as the BinaryMessenger
    final MyPlugin instance = MyPlugin();

  Future<dynamic> handleMethodCall(MethodCall call) async {
    // ...

  // ...
Available Extensions


Registrar([@Deprecated('This argument is ignored. ' 'This feature was deprecated after v1.24.0-7.0.pre.') BinaryMessenger? binaryMessenger])
Creates a Registrar.


hashCode int
The hash code for this object.
no setterinherited
messenger BinaryMessenger
Returns this.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


handleFrameworkMessage(String channel, ByteData? data, PlatformMessageResponseCallback? callback) Future<void>
Message handler for web plugins.
handlePlatformMessage(String channel, ByteData? data, PlatformMessageResponseCallback? callback) Future<void>
Receives a platform message from the framework.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
registerMessageHandler() → void
Registers the registrar's message handler (handlePlatformMessage) with the engine, so that plugin messages are correctly dispatched to the relevant registered plugin.
send(String channel, ByteData? message) Future<ByteData?>
Sends a platform message from the platform side back to the framework.
setMessageHandler(String channel, MessageHandler? handler) → void
Set a callback for receiving messages from the platform plugins on the given channel, without decoding them.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.