TypeChannelMessenger class Null safety

Stores instance pairs and handles communication for TypeChannels.

Type channels allow for types/classes of different languages to communicate (e.g. a Camera class in Dart may want to communicate with a Camera class in Java). The Camera class in Dart may want to control when the Java Camera class should call a static method, instantiate a new instance, or call methods on that instance.

To control specific instances for a type channel, this class pairs Dart instances to instances in another language (e.g. Java/Obj-c). This API refers to this as an instance pair.

A paired object then acts as the key to communicate with it's paired object in another language and can be used to represent its paired instance when passed as an argument.

TypeChannelMessenger 1 TypeChannelMessenger 2 |------------------| |------------------| | Dart Instances |<--------->| Java Instances | |------------------| |------------------|





converter InstanceConverter
Attempts to convert objects to PairedInstances and vice-versa.
hashCode int
The hash code for this object.
instanceManager InstanceManager
Maintains access to instances.
messageDispatcher TypeChannelMessageDispatcher
Dispatches messages to other TypeChannelMessengers.
runtimeType Type
A representation of the runtime type of the object.


createNewInstancePair(String channelName, Object instance, List<Object?> arguments, {required bool owner}) Future<PairedInstance?>
Create a new PairedInstance to be paired with instance.
disposeInstancePair(Object instance) Future<void>
Dispose the instance pair containing instance.
getChannelHandler(String channelName) TypeChannelHandler<Object>?
Retrieve the registered TypeChannelHandler for a type channel.
getPairedObject(PairedInstance pairedInstance) Object?
Retrieve the Object paired to pairedInstance.
getPairedPairedInstance(Object instance) PairedInstance?
Retrieve the PairedInstance paired to instance.
isPaired(Object instance) bool
Whether instance is paired with a PairedInstance.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
onReceiveCreateNewInstancePair(String channelName, PairedInstance pairedInstance, List<Object?> arguments, {required bool owner}) Object?
Create and store a new instance pair for a type channel.
onReceiveDisposeInstancePair(PairedInstance pairedInstance) → void
Dispose of the pair containing pairedInstance.
onReceiveInvokeMethod(String channelName, PairedInstance pairedInstance, String methodName, List<Object?> arguments) Object?
Invoke a method on pairedInstance for a type channel.
onReceiveInvokeStaticMethod(String channelName, String methodName, List<Object?> arguments) Object?
Invoke a static method for a type channel.
registerHandler(String channelName, TypeChannelHandler<Object> handler) → void
Sets a TypeChannelHandler for a type channel with channelName.
sendInvokeMethod(String channelName, Object instance, String methodName, List<Object?> arguments) Future<Object?>
Send a message to invoke a method on the PairedInstance paired with instance.
sendInvokeStaticMethod(String channelName, String methodName, List<Object?> arguments) Future<Object?>
Invoke static method methodName on type channel of channelName.
toString() String
A string representation of this object.
unregisterHandler(String channelName) → void
Removes a TypeChannelHandler for the type channel of channelName.


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