Google is committed to advancing racial equity for Black communities. See how.

exposeService<T extends Service> method

void exposeService <T extends Service>(FutureOr<T> serviceImpl)

Associate serviceImpl to this Agent and exposes it to the rest of the system so that it can be discovered and connected to. Notice that serviceImpl is of type FutureOr<T>, where T represents the service type, to enable the ability to wait for any asynchronous operations to finish before initializing and exposing the service.

Note: Multiple connections will be allowed to this serviceImpl.

Usage example:

import 'package:fidl_fuchsia_foo/fidl_async.dart' as fidl;
import 'package:fuchsia_modular/agent.dart';
import 'src/foo_service_impl.dart';

void main(List<String> args) {

class FooServiceImpl extends fidl.FooService { ... }


void exposeService<T extends Service>(FutureOr<T> serviceImpl);