Registrar class Null safety

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(
      'com.my_plugin/my_plugin',
      const StandardMethodCodec(),
      registrar, // the registrar is used as the BinaryMessenger
    );
    final MyPlugin instance = MyPlugin();
    channel.setMethodCallHandler(instance.handleMethodCall);
  }
  // ...
}
Inheritance
Implementers
Available Extensions

Constructors

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

Properties

hashCode int
The hash code for this object.
read-onlyinherited
messenger BinaryMessenger
Returns this.
Deprecated('This property is redundant. It returns the object on which it is called. ' 'This feature was deprecated after v1.24.0-7.0.pre.')">@Deprecated('This property is redundant. It returns the object on which it is called. ' 'This feature was deprecated after v1.24.0-7.0.pre.')read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

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.
Deprecated('Use handleFrameworkMessage instead. ' 'This feature was deprecated after v1.24.0-7.0.pre.')">@Deprecated('Use handleFrameworkMessage instead. ' 'This feature was deprecated after v1.24.0-7.0.pre.')override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
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.
override
setMessageHandler(String channel, MessageHandler? handler) → void
Set a callback for receiving messages from the platform plugins on the given channel, without decoding them.
override
toString() String
A string representation of this object.
inherited

Operators

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