blob: 996d979dda6a0b2a44d119448cb252b0c6af5e5e [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:fidl_fidl_examples_echo/fidl.dart';
import 'package:lib.app.dart/app.dart';
import 'package:fidl_fuchsia_sys/fidl.dart';
StartupContext _context;
EchoProxy _echo;
void main(List<String> args) {
String server = 'fuchsia-pkg://fuchsia.com/echo_dart#meta/echo_server_dart.cmx';
if (args.length >= 2 && args[0] == '--server') {
server = args[1];
}
_context = StartupContext.fromStartupInfo();
final Services services = Services();
final LaunchInfo launchInfo =
LaunchInfo(url: server, directoryRequest: services.request());
_context.launcher.createComponent(launchInfo, null);
_echo = EchoProxy();
_echo.ctrl.bind(services.connectToServiceByName<Echo>(Echo.$serviceName));
_echo.echoString('hello', (String response) {
print('***** Response: $response');
});
}