FloatyProxyHost class final
Main-app-side proxy host that registers service providers.
The overlay calls services registered here through
FloatyProxyClient. Each service receives a method name and
parameters and returns a JSON-compatible result:
final host = FloatyProxyHost()
..register('location', (method, params) async {
final pos = await Geolocator.getCurrentPosition();
return {'lat': pos.latitude, 'lng': pos.longitude};
});
Constructors
- FloatyProxyHost()
-
Creates a host and attaches it to the shared channel.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Releases resources and unregisters the channel handler.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
String service, FutureOr< Object?> handler(String method, Map<String, dynamic> params)) → void -
Registers
handleras the provider forservice(e.g.'location'). -
toString(
) → String -
A string representation of this object.
inherited
-
unregister(
String service) → void - Removes a registered service provider.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited