blob: 8262210bb53da695abb8e8de0ea040979c0e6eef [file] [log] [blame] [view]
# InterfaceRequest<T> class
<p>A channel over which messages from interface T can be received.</p>
<p>An interface request holds a <a href="../package-fidl_fidl/InterfaceRequest/channel.md">channel</a> whose peer expects to be able to send
messages from the FIDL interface T. A channel held by an interface request
is not currently bound, which means messages cannot yet be exchanged with
the channel's peer.</p>
<p>To receive messages sent over the channel, bind the interface handle using
<a href="../package-fidl_fidl/Binding/bind.md">Binding&lt;T&gt;.bind</a> on a <code>TBinding</code> object, which you typically hold as a
private member variable in a class that implements <code>T</code>.</p>
<p>Example:</p>
<pre class="language-dart"><code class="language-dart">class FooImpl extends Foo {
final FooBinding _binding = new FooBinding();
void bind(InterfaceRequest&lt;T&gt; request) {
_binding.bind(request);
}
@override
void bar() {
print('Received bar message.');
}
}
</code></pre>
<p>To obtain an interface request to send over a channel, used the
<a href="../package-fidl_fidl/ProxyController/request.md">ProxyController&lt;T&gt;.request</a> method on the <a href="../package-fidl_fidl/Proxy/ctrl.md">Proxy&lt;T&gt;.ctrl</a> property of an
object of type <code>TProxy</code>.</p>
<p>Example:</p>
<pre class="language-dart"><code class="language-dart">FooProxy foo = new FooProxy();
InterfaceRequest&lt;T&gt; request = foo.ctrl.request();
</code></pre>
## Constructors
[InterfaceRequest](../package-fidl_fidl/InterfaceRequest/InterfaceRequest.md) ([Channel](../zircon/Channel-class.md) _channel)
Creates an interface request that wraps the given channel.
## Properties
##### [channel](../package-fidl_fidl/InterfaceRequest/channel.md) &#8594; [Channel](../zircon/Channel-class.md)
The underlying channel messages will be received over when the interface
handle is bound to <a href="../package-fidl_fidl/Binding-class.md">Binding</a>.
_read-only_
##### [hashCode](../package-fidl_fidl/InterfaceRequest/hashCode.md) &#8594; int
The hash code for this object.
_read-only, inherited_
##### [runtimeType](../package-fidl_fidl/InterfaceRequest/runtimeType.md) &#8594; Type
A representation of the runtime type of the object.
_read-only, inherited_
## Methods
##### [close](../package-fidl_fidl/InterfaceRequest/close.md)() void
Closes the underlying channel.
##### [noSuchMethod](../package-fidl_fidl/InterfaceRequest/noSuchMethod.md)(Invocation invocation) dynamic
Invoked when a non-existent method or property is accessed.
_inherited_
##### [passChannel](../package-fidl_fidl/InterfaceRequest/passChannel.md)() [Channel](../zircon/Channel-class.md)
Returns <a href="../package-fidl_fidl/InterfaceRequest/channel.md">channel</a> and sets <a href="../package-fidl_fidl/InterfaceRequest/channel.md">channel</a> to <code>null</code>.
##### [toString](../package-fidl_fidl/InterfaceRequest/toString.md)() String
A string representation of this object.
_inherited_
## Operators
##### [operator ==](../package-fidl_fidl/InterfaceRequest/operator_equals.md)(Object other) bool
The equality operator.
_inherited_