FloatyProxyClient constructor

FloatyProxyClient({
  1. Duration timeout = const Duration(seconds: 10),
})

Overlay-side proxy client that calls services on the main app.

Send requests to service providers registered on FloatyProxyHost and await results.

final client = FloatyProxyClient();

final result = await client.call('location', 'getCurrentPosition');
// result == {'lat': 12.0, 'lng': -86.0}

Throws FloatyProxyDisconnectedException if the main app is not connected (unless a fallback is provided), FloatyProxyTimeoutException if the call takes longer than timeout, and FloatyProxyErrorException if the host handler threw.

Implementation

FloatyProxyClient({this.timeout = const Duration(seconds: 10)}) {
  FloatyChannel.registerHandler(_prefix, _onMessage);
  FloatyChannel.ensureListening();
}