Skip to content

Instantly share code, notes, and snippets.

@ianloic
Created July 12, 2018 18:25
Show Gist options
  • Save ianloic/8c80b77a5b6c49c61d55ec872163e85e to your computer and use it in GitHub Desktop.
Save ianloic/8c80b77a5b6c49c61d55ec872163e85e to your computer and use it in GitHub Desktop.
// 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.
//
// WARNING: This file is machine generated by fidlgen.
library fidl_fidl_examples_events$async;
import 'dart:async';
import 'dart:typed_data';
import 'package:fidl/fidl.dart' as $fidl;
import 'package:meta/meta.dart';
import 'package:zircon/zircon.dart';
// ignore_for_file: always_specify_types
// ignore_for_file: avoid_positional_boolean_parameters
// ignore_for_file: avoid_returning_null
// ignore_for_file: cascade_invocations
// ignore_for_file: constant_identifier_names
// ignore_for_file: one_member_abstracts
// ignore_for_file: prefer_constructors_over_static_methods
// ignore_for_file: prefer_single_quotes
// ignore_for_file: public_member_api_docs
// ignore_for_file: unused_import
// ignore_for_file: unused_local_variable
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: library_prefixes
// ignore_for_file: prefer_typing_uninitialized_variables
// ignore_for_file: avoid_js_rounded_ints
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: prefer_generic_function_type_aliases
// ignore_for_file: prefer_equal_for_default_values
// ignore_for_file: avoid_catches_without_on_clauses
// ignore_for_file: unused_shown_name
// ignore_for_file: unnecessary_lambdas
// ignore: unused_element, avoid_private_typedef_functions
typedef _VoidCallback = void Function();
// dog: (String s, bool b)
const int _kAnimalPlanet_Dog_Ordinal = 1;
const $fidl.MethodType _kAnimalPlanet_Dog_Type = const $fidl.MethodType(
request: const <$fidl.MemberType>[
const $fidl.MemberType<String>(type: const $fidl.StringType(maybeElementCount: null, nullable: false), offset: 16),
const $fidl.MemberType<bool>(type: const $fidl.BoolType(), offset: 32),
],
response: null,
name: "AnimalPlanet.Dog",
);
// cat: (String s) -> (bool b)
const int _kAnimalPlanet_Cat_Ordinal = 2;
const $fidl.MethodType _kAnimalPlanet_Cat_Type = const $fidl.MethodType(
request: const <$fidl.MemberType>[
const $fidl.MemberType<String>(type: const $fidl.StringType(maybeElementCount: null, nullable: false), offset: 16),
],
response: const <$fidl.MemberType>[
const $fidl.MemberType<bool>(type: const $fidl.BoolType(), offset: 16),
],
name: "AnimalPlanet.Cat",
);
// bird: -> (String s, bool b)
const int _kAnimalPlanet_Bird_Ordinal = 3;
const $fidl.MethodType _kAnimalPlanet_Bird_Type = const $fidl.MethodType(
request: null,
response: const <$fidl.MemberType>[
const $fidl.MemberType<String>(type: const $fidl.StringType(maybeElementCount: null, nullable: false), offset: 16),
const $fidl.MemberType<bool>(type: const $fidl.BoolType(), offset: 32),
],
name: "AnimalPlanet.Bird",
);
class AnimalPlanet$Bird$Response {
final String s;
final bool b;
AnimalPlanet$Bird$Response(
this.s,
this.b,);
}
abstract class AnimalPlanet {
static const String $serviceName = null;
Future<Null> dog(String s, bool b);
Future<bool> cat(String s);
Stream<AnimalPlanet$Bird$Response> get bird;
}
class AnimalPlanetProxy extends $fidl.AsyncProxy<AnimalPlanet>
implements AnimalPlanet {
AnimalPlanetProxy() : super(new $fidl.AsyncProxyController<AnimalPlanet>($serviceName: null, $interfaceName: 'AnimalPlanet')) {
ctrl.onResponse = _handleResponse;
ctrl.whenClosed.then((_) {
_birdEventStreamController.close();
}, onError: (_) { });
}
void _handleEvent($fidl.Message $message) {
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
case _kAnimalPlanet_Bird_Ordinal:
try {
final List<$fidl.MemberType> $types = _kAnimalPlanet_Bird_Type.response;
$decoder.claimMemory(40);
_birdEventStreamController.add(new AnimalPlanet$Bird$Response(
$types[0].decode($decoder, 0),
$types[1].decode($decoder, 0),));
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
final String _name = _kAnimalPlanet_Bird_Type.name;
ctrl.proxyError(new $fidl.FidlError('Exception handling event $_name: $_e'));
ctrl.close();
rethrow;
}
break;
default:
ctrl.proxyError(new $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
void _handleResponse($fidl.Message $message) {
final int $txid = $message.txid;
if ($txid == 0) {
_handleEvent($message);
return;
}
final Completer $completer = ctrl.getCompleter($txid);
if ($completer == null) {
$message.closeHandles();
return;
}
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
case _kAnimalPlanet_Cat_Ordinal:
try {
final List<$fidl.MemberType> $types = _kAnimalPlanet_Cat_Type.response;
$decoder.claimMemory(20);
$completer.complete($types[0].decode($decoder, 0),);
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
final String _name = _kAnimalPlanet_Cat_Type.name;
ctrl.proxyError(new $fidl.FidlError('Exception handling method response $_name: $_e'));
ctrl.close();
rethrow;
}
break;
default:
ctrl.proxyError(new $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
@override
Future<Null> dog(String s, bool b) async {
if (!ctrl.isBound) {
return new Future.error(new $fidl.FidlStateException('The proxy is closed.'));
}
final $fidl.Encoder $encoder = new $fidl.Encoder(_kAnimalPlanet_Dog_Ordinal);
$encoder.alloc(40 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kAnimalPlanet_Dog_Type.request;
$types[0].encode($encoder, s, 0);
$types[1].encode($encoder, b, 0);
return new Future.sync(() {
ctrl.sendMessage($encoder.message);
});
}
@override
Future<bool> cat(String s) async {
if (!ctrl.isBound) {
return new Future.error(new $fidl.FidlStateException('The proxy is closed.'));
}
final $fidl.Encoder $encoder = new $fidl.Encoder(_kAnimalPlanet_Cat_Ordinal);
$encoder.alloc(32 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kAnimalPlanet_Cat_Type.request;
$types[0].encode($encoder, s, 0);
final $completer = new Completer<bool>();
ctrl.sendMessageWithResponse($encoder.message, $completer);
return $completer.future;
}
final _birdEventStreamController = new StreamController<AnimalPlanet$Bird$Response>.broadcast();
@override
Stream<AnimalPlanet$Bird$Response> get bird => _birdEventStreamController.stream;
}
class AnimalPlanetBinding extends $fidl.AsyncBinding<AnimalPlanet> {
AnimalPlanetBinding() : super("AnimalPlanet") {
final List<StreamSubscription<dynamic>> $subscriptions = [];
void $unsubscribe() {
for (final $sub in $subscriptions) {
$sub.cancel();
}
$subscriptions.clear();
}
whenBound.then((_) {
$subscriptions.add(impl.bird.listen(($response) {
final $fidl.Encoder $encoder = new $fidl.Encoder(_kAnimalPlanet_Bird_Ordinal);
$encoder.alloc(40 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kAnimalPlanet_Bird_Type.response;
$types[0].encode($encoder, $response.s, 0);
$types[1].encode($encoder, $response.b, 0);
sendMessage($encoder.message);
}));
});
whenClosed.then((_) => $unsubscribe());
}
@override
void handleMessage($fidl.Message $message, $fidl.MessageSink $respond) {
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
case _kAnimalPlanet_Dog_Ordinal:
try {
final List<$fidl.MemberType> $types = _kAnimalPlanet_Dog_Type.request;
$decoder.claimMemory(40);
final Future<Null> $future = impl.dog(
$types[0].decode($decoder, 0),
$types[1].decode($decoder, 0),);
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
close();
final String _name = _kAnimalPlanet_Dog_Type.name;
print('Exception handling method call $_name: $_e');
rethrow;
}
break;
case _kAnimalPlanet_Cat_Ordinal:
try {
final List<$fidl.MemberType> $types = _kAnimalPlanet_Cat_Type.request;
$decoder.claimMemory(32);
final Future<bool> $future = impl.cat(
$types[0].decode($decoder, 0),);
$future.then(($response) {
final $fidl.Encoder $encoder = new $fidl.Encoder(_kAnimalPlanet_Cat_Ordinal);
$encoder.alloc(20 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kAnimalPlanet_Cat_Type.response;
$types[0].encode($encoder, $response, 0);
$fidl.Message $responseMessage = $encoder.message;
$responseMessage.txid = $message.txid;
$respond($responseMessage);
}, onError: (_e) {
close();
final String _name = _kAnimalPlanet_Cat_Type.name;
print('Exception handling method call $_name: $_e');
});
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
close();
final String _name = _kAnimalPlanet_Cat_Type.name;
print('Exception handling method call $_name: $_e');
rethrow;
}
break;
default:
throw new $fidl.FidlError('Unexpected message name');
}
}
}
// 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.
//
// WARNING: This file is machine generated by fidlgen.
library fidl_fidl_examples_example5$async;
import 'dart:async';
import 'dart:typed_data';
import 'package:fidl/fidl.dart' as $fidl;
import 'package:meta/meta.dart';
import 'package:zircon/zircon.dart';
// ignore_for_file: always_specify_types
// ignore_for_file: avoid_positional_boolean_parameters
// ignore_for_file: avoid_returning_null
// ignore_for_file: cascade_invocations
// ignore_for_file: constant_identifier_names
// ignore_for_file: one_member_abstracts
// ignore_for_file: prefer_constructors_over_static_methods
// ignore_for_file: prefer_single_quotes
// ignore_for_file: public_member_api_docs
// ignore_for_file: unused_import
// ignore_for_file: unused_local_variable
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: library_prefixes
// ignore_for_file: prefer_typing_uninitialized_variables
// ignore_for_file: avoid_js_rounded_ints
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: prefer_generic_function_type_aliases
// ignore_for_file: prefer_equal_for_default_values
// ignore_for_file: avoid_catches_without_on_clauses
// ignore_for_file: unused_shown_name
// ignore_for_file: unnecessary_lambdas
class Enum extends $fidl.Enum {
factory Enum(int v) {
switch (v) {
case 23:
return x;
default:
return null;
}
}
static const Enum x = const Enum._(23);
const Enum._(this.value);
@override
final int value;
static const Map<String, Enum> valuesMap = const {
'x': x,
};
static const List<Enum> values = const [
x,
];
static Enum valueOf(String name) => valuesMap[name];
@override
String toString() {
switch (value) {
case 23:
return 'Enum.x';
default:
return null;
}
}
static Enum _ctor(int v) => new Enum(v);
}
const $fidl.EnumType<Enum> kEnum_Type = const $fidl.EnumType<Enum>(type: const $fidl.Uint32Type(), ctor: Enum._ctor);
class Enum2 extends $fidl.Enum {
factory Enum2(int v) {
switch (v) {
case 0:
return enum0;
case 23:
return enum1;
default:
return null;
}
}
static const Enum2 enum0 = const Enum2._(0);
static const Enum2 enum1 = const Enum2._(23);
const Enum2._(this.value);
@override
final int value;
static const Map<String, Enum2> valuesMap = const {
'enum0': enum0,
'enum1': enum1,
};
static const List<Enum2> values = const [
enum0,
enum1,
];
static Enum2 valueOf(String name) => valuesMap[name];
@override
String toString() {
switch (value) {
case 0:
return 'Enum2.enum0';
case 23:
return 'Enum2.enum1';
default:
return null;
}
}
static Enum2 _ctor(int v) => new Enum2(v);
}
const $fidl.EnumType<Enum2> kEnum2_Type = const $fidl.EnumType<Enum2>(type: const $fidl.Uint64Type(), ctor: Enum2._ctor);
class Enum23 extends $fidl.Enum {
factory Enum23(int v) {
switch (v) {
case 0:
return enum3;
case -23:
return enum4;
default:
return null;
}
}
static const Enum23 enum3 = const Enum23._(0);
static const Enum23 enum4 = const Enum23._(-23);
const Enum23._(this.value);
@override
final int value;
static const Map<String, Enum23> valuesMap = const {
'enum3': enum3,
'enum4': enum4,
};
static const List<Enum23> values = const [
enum3,
enum4,
];
static Enum23 valueOf(String name) => valuesMap[name];
@override
String toString() {
switch (value) {
case 0:
return 'Enum23.enum3';
case -23:
return 'Enum23.enum4';
default:
return null;
}
}
static Enum23 _ctor(int v) => new Enum23(v);
}
const $fidl.EnumType<Enum23> kEnum23_Type = const $fidl.EnumType<Enum23>(type: const $fidl.Int32Type(), ctor: Enum23._ctor);
enum NotAPointTag {
x,
y,
z,
}
class NotAPoint extends $fidl.Union {
const NotAPoint.withX(int value)
: _data = value, tag = NotAPointTag.x;
const NotAPoint.withY(int value)
: _data = value, tag = NotAPointTag.y;
const NotAPoint.withZ(int value)
: _data = value, tag = NotAPointTag.z;
NotAPoint._(this.tag, Object data) : _data = data;
final NotAPointTag tag;
final _data;
int get x {
if (tag != NotAPointTag.x) {
return null;
}
return _data;
}
int get y {
if (tag != NotAPointTag.y) {
return null;
}
return _data;
}
int get z {
if (tag != NotAPointTag.z) {
return null;
}
return _data;
}
@override
String toString() {
switch (tag) {
case NotAPointTag.x:
return 'NotAPoint.x($x)';
case NotAPointTag.y:
return 'NotAPoint.y($y)';
case NotAPointTag.z:
return 'NotAPoint.z($z)';
default:
return null;
}
}
@override
int get $index => tag.index;
@override
Object get $data => _data;
static NotAPoint _ctor(int index, Object data) {
return new NotAPoint._(NotAPointTag.values[index], data);
}
}
const $fidl.UnionType<NotAPoint> kNotAPoint_Type = const $fidl.UnionType<NotAPoint>(
encodedSize: 16,
members: const <$fidl.MemberType>[
const $fidl.MemberType<int>(type: const $fidl.Uint64Type(), offset: 8),
const $fidl.MemberType<int>(type: const $fidl.Uint32Type(), offset: 8),
const $fidl.MemberType<int>(type: const $fidl.Uint16Type(), offset: 8),
],
ctor: NotAPoint._ctor,
);
class Point extends $fidl.Struct {
const Point({
@required this.x,
});
Point._(List<Object> argv)
: x = argv[0];
final int x;
@override
List<Object> get $fields {
return <Object>[
x,
];
}
@override
String toString() {
return 'Point(x: $x)';
}
static Point _ctor(List<Object> argv) => new Point._(argv);
}
const $fidl.StructType<Point> kPoint_Type = const $fidl.StructType<Point>(
encodedSize: 8,
members: const <$fidl.MemberType>[
const $fidl.MemberType<int>(type: const $fidl.Uint64Type(), offset: 0),
],
ctor: Point._ctor,
);
// ignore: unused_element, avoid_private_typedef_functions
typedef _VoidCallback = void Function();
// oneFunction: (String s, bool b) -> ()
const int _kThing_one_function_Ordinal = 1;
const $fidl.MethodType _kThing_one_function_Type = const $fidl.MethodType(
request: const <$fidl.MemberType>[
const $fidl.MemberType<String>(type: const $fidl.StringType(maybeElementCount: null, nullable: false), offset: 16),
const $fidl.MemberType<bool>(type: const $fidl.BoolType(), offset: 32),
],
response: null,
name: "Thing.one_function",
);
// twoFunction: (String s, bool b)
const int _kThing_two_function_Ordinal = 2;
const $fidl.MethodType _kThing_two_function_Type = const $fidl.MethodType(
request: const <$fidl.MemberType>[
const $fidl.MemberType<String>(type: const $fidl.StringType(maybeElementCount: null, nullable: false), offset: 16),
const $fidl.MemberType<bool>(type: const $fidl.BoolType(), offset: 32),
],
response: null,
name: "Thing.two_function",
);
// threeFunction: (String s, $fidl.InterfaceRequest<Thing> r)
const int _kThing_three_function_Ordinal = 3;
const $fidl.MethodType _kThing_three_function_Type = const $fidl.MethodType(
request: const <$fidl.MemberType>[
const $fidl.MemberType<String>(type: const $fidl.StringType(maybeElementCount: null, nullable: false), offset: 16),
const $fidl.MemberType<$fidl.InterfaceRequest<Thing>>(type: const $fidl.InterfaceRequestType<Thing>(nullable: false), offset: 32),
],
response: null,
name: "Thing.three_function",
);
// fourFunction: (String s, $fidl.InterfaceRequest<Thing> r) -> (Channel r)
const int _kThing_four_function_Ordinal = 4;
const $fidl.MethodType _kThing_four_function_Type = const $fidl.MethodType(
request: const <$fidl.MemberType>[
const $fidl.MemberType<String>(type: const $fidl.StringType(maybeElementCount: null, nullable: false), offset: 16),
const $fidl.MemberType<$fidl.InterfaceRequest<Thing>>(type: const $fidl.InterfaceRequestType<Thing>(nullable: false), offset: 32),
],
response: const <$fidl.MemberType>[
const $fidl.MemberType<Channel>(type: const $fidl.ChannelType(nullable: false), offset: 16),
],
name: "Thing.four_function",
);
abstract class Thing {
static const String $serviceName = "fidl.examples.example5.Thing";
Future<Null> oneFunction(String s, bool b);
Future<Null> twoFunction(String s, bool b);
Future<Null> threeFunction(String s, $fidl.InterfaceRequest<Thing> r);
Future<Channel> fourFunction(String s, $fidl.InterfaceRequest<Thing> r);
}
class ThingProxy extends $fidl.AsyncProxy<Thing>
implements Thing {
ThingProxy() : super(new $fidl.AsyncProxyController<Thing>($serviceName: "fidl.examples.example5.Thing", $interfaceName: 'Thing')) {
ctrl.onResponse = _handleResponse;
}
void _handleEvent($fidl.Message $message) {
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
default:
ctrl.proxyError(new $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
void _handleResponse($fidl.Message $message) {
final int $txid = $message.txid;
if ($txid == 0) {
_handleEvent($message);
return;
}
final Completer $completer = ctrl.getCompleter($txid);
if ($completer == null) {
$message.closeHandles();
return;
}
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
case _kThing_one_function_Ordinal:
try {
final List<$fidl.MemberType> $types = _kThing_one_function_Type.response;
$decoder.claimMemory(16);
$completer.complete(null);
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
final String _name = _kThing_one_function_Type.name;
ctrl.proxyError(new $fidl.FidlError('Exception handling method response $_name: $_e'));
ctrl.close();
rethrow;
}
break;
case _kThing_four_function_Ordinal:
try {
final List<$fidl.MemberType> $types = _kThing_four_function_Type.response;
$decoder.claimMemory(20);
$completer.complete($types[0].decode($decoder, 0),);
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
final String _name = _kThing_four_function_Type.name;
ctrl.proxyError(new $fidl.FidlError('Exception handling method response $_name: $_e'));
ctrl.close();
rethrow;
}
break;
default:
ctrl.proxyError(new $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
@override
Future<Null> oneFunction(String s, bool b) async {
if (!ctrl.isBound) {
return new Future.error(new $fidl.FidlStateException('The proxy is closed.'));
}
final $fidl.Encoder $encoder = new $fidl.Encoder(_kThing_one_function_Ordinal);
$encoder.alloc(40 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kThing_one_function_Type.request;
$types[0].encode($encoder, s, 0);
$types[1].encode($encoder, b, 0);
final $completer = new Completer<Null>();
ctrl.sendMessageWithResponse($encoder.message, $completer);
return $completer.future;
}
@override
Future<Null> twoFunction(String s, bool b) async {
if (!ctrl.isBound) {
return new Future.error(new $fidl.FidlStateException('The proxy is closed.'));
}
final $fidl.Encoder $encoder = new $fidl.Encoder(_kThing_two_function_Ordinal);
$encoder.alloc(40 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kThing_two_function_Type.request;
$types[0].encode($encoder, s, 0);
$types[1].encode($encoder, b, 0);
return new Future.sync(() {
ctrl.sendMessage($encoder.message);
});
}
@override
Future<Null> threeFunction(String s, $fidl.InterfaceRequest<Thing> r) async {
if (!ctrl.isBound) {
return new Future.error(new $fidl.FidlStateException('The proxy is closed.'));
}
final $fidl.Encoder $encoder = new $fidl.Encoder(_kThing_three_function_Ordinal);
$encoder.alloc(40 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kThing_three_function_Type.request;
$types[0].encode($encoder, s, 0);
$types[1].encode($encoder, r, 0);
return new Future.sync(() {
ctrl.sendMessage($encoder.message);
});
}
@override
Future<Channel> fourFunction(String s, $fidl.InterfaceRequest<Thing> r) async {
if (!ctrl.isBound) {
return new Future.error(new $fidl.FidlStateException('The proxy is closed.'));
}
final $fidl.Encoder $encoder = new $fidl.Encoder(_kThing_four_function_Ordinal);
$encoder.alloc(40 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kThing_four_function_Type.request;
$types[0].encode($encoder, s, 0);
$types[1].encode($encoder, r, 0);
final $completer = new Completer<Channel>();
ctrl.sendMessageWithResponse($encoder.message, $completer);
return $completer.future;
}
}
class ThingBinding extends $fidl.AsyncBinding<Thing> {
ThingBinding() : super("Thing");
@override
void handleMessage($fidl.Message $message, $fidl.MessageSink $respond) {
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
case _kThing_one_function_Ordinal:
try {
final List<$fidl.MemberType> $types = _kThing_one_function_Type.request;
$decoder.claimMemory(40);
final Future<Null> $future = impl.oneFunction(
$types[0].decode($decoder, 0),
$types[1].decode($decoder, 0),);
$future.then(($response) {
final $fidl.Encoder $encoder = new $fidl.Encoder(_kThing_one_function_Ordinal);
$fidl.Message $responseMessage = $encoder.message;
$responseMessage.txid = $message.txid;
$respond($responseMessage);
}, onError: (_e) {
close();
final String _name = _kThing_one_function_Type.name;
print('Exception handling method call $_name: $_e');
});
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
close();
final String _name = _kThing_one_function_Type.name;
print('Exception handling method call $_name: $_e');
rethrow;
}
break;
case _kThing_two_function_Ordinal:
try {
final List<$fidl.MemberType> $types = _kThing_two_function_Type.request;
$decoder.claimMemory(40);
final Future<Null> $future = impl.twoFunction(
$types[0].decode($decoder, 0),
$types[1].decode($decoder, 0),);
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
close();
final String _name = _kThing_two_function_Type.name;
print('Exception handling method call $_name: $_e');
rethrow;
}
break;
case _kThing_three_function_Ordinal:
try {
final List<$fidl.MemberType> $types = _kThing_three_function_Type.request;
$decoder.claimMemory(40);
final Future<Null> $future = impl.threeFunction(
$types[0].decode($decoder, 0),
$types[1].decode($decoder, 0),);
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
close();
final String _name = _kThing_three_function_Type.name;
print('Exception handling method call $_name: $_e');
rethrow;
}
break;
case _kThing_four_function_Ordinal:
try {
final List<$fidl.MemberType> $types = _kThing_four_function_Type.request;
$decoder.claimMemory(40);
final Future<Channel> $future = impl.fourFunction(
$types[0].decode($decoder, 0),
$types[1].decode($decoder, 0),);
$future.then(($response) {
final $fidl.Encoder $encoder = new $fidl.Encoder(_kThing_four_function_Ordinal);
$encoder.alloc(20 - $fidl.kMessageHeaderSize);
final List<$fidl.MemberType> $types = _kThing_four_function_Type.response;
$types[0].encode($encoder, $response, 0);
$fidl.Message $responseMessage = $encoder.message;
$responseMessage.txid = $message.txid;
$respond($responseMessage);
}, onError: (_e) {
close();
final String _name = _kThing_four_function_Type.name;
print('Exception handling method call $_name: $_e');
});
// ignore: avoid_catches_without_on_clauses
} catch(_e) {
close();
final String _name = _kThing_four_function_Type.name;
print('Exception handling method call $_name: $_e');
rethrow;
}
break;
default:
throw new $fidl.FidlError('Unexpected message name');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment