blob: 243ffa2df4fb55652543cd60a0e2fa7977350281 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
library fidl_fidl_test_json_async;
import 'dart:async' as $async;
import 'dart:core' hide Set;
import 'dart:developer';
import 'dart:typed_data';
import 'package:fidl/fidl.dart' as $fidl;
import 'package:meta/meta.dart';
import 'package:zircon/zircon.dart' as $zx;
// 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_for_file: comment_references
// ignore_for_file: avoid_unused_constructor_parameters
enum FlexibleFooTag {
$unknown,
s, // 0x1
i, // 0x2
}
const Map<int, FlexibleFooTag> _FlexibleFooTag_map = {
1: FlexibleFooTag.s,
2: FlexibleFooTag.i,
};
class FlexibleFoo extends $fidl.XUnion {
const FlexibleFoo.withS(String value)
: _ordinal = 1,
_data = value;
const FlexibleFoo.withI(int value)
: _ordinal = 2,
_data = value;
FlexibleFoo._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
FlexibleFooTag get $tag {
final FlexibleFooTag $rawtag = _FlexibleFooTag_map[_ordinal];
return $rawtag == null ? FlexibleFooTag.$unknown : $rawtag;
}
String get s {
if (_ordinal != 1) {
return null;
}
return _data;
}
int get i {
if (_ordinal != 2) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 1:
return 'FlexibleFoo.s($s)';
case 2:
return 'FlexibleFoo.i($i)';
default:
return 'FlexibleFoo.<UNKNOWN>';
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static FlexibleFoo _ctor(int ordinal, Object data) {
return FlexibleFoo._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<FlexibleFoo> kFlexibleFoo_Type =
$fidl.XUnionType<FlexibleFoo>(
members: <int, $fidl.FidlType>{
1: $fidl.StringType(maybeElementCount: null, nullable: false),
2: $fidl.Int32Type(),
},
ctor: FlexibleFoo._ctor,
nullable: false,
flexible: true,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<FlexibleFoo> kFlexibleFoo_OptType =
$fidl.XUnionType<FlexibleFoo>(
members: <int, $fidl.FidlType>{
1: $fidl.StringType(maybeElementCount: null, nullable: false),
2: $fidl.Int32Type(),
},
ctor: FlexibleFoo._ctor,
nullable: true,
flexible: true,
);
enum StrictFooTag {
s, // 0x1
i, // 0x2
}
const Map<int, StrictFooTag> _StrictFooTag_map = {
1: StrictFooTag.s,
2: StrictFooTag.i,
};
class StrictFoo extends $fidl.XUnion {
const StrictFoo.withS(String value)
: _ordinal = 1,
_data = value;
const StrictFoo.withI(int value)
: _ordinal = 2,
_data = value;
StrictFoo._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
StrictFooTag get $tag => _StrictFooTag_map[_ordinal];
String get s {
if (_ordinal != 1) {
return null;
}
return _data;
}
int get i {
if (_ordinal != 2) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 1:
return 'StrictFoo.s($s)';
case 2:
return 'StrictFoo.i($i)';
default:
return null;
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static StrictFoo _ctor(int ordinal, Object data) {
return StrictFoo._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<StrictFoo> kStrictFoo_Type = $fidl.XUnionType<StrictFoo>(
members: <int, $fidl.FidlType>{
1: $fidl.StringType(maybeElementCount: null, nullable: false),
2: $fidl.Int32Type(),
},
ctor: StrictFoo._ctor,
nullable: false,
flexible: false,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<StrictFoo> kStrictFoo_OptType =
$fidl.XUnionType<StrictFoo>(
members: <int, $fidl.FidlType>{
1: $fidl.StringType(maybeElementCount: null, nullable: false),
2: $fidl.Int32Type(),
},
ctor: StrictFoo._ctor,
nullable: true,
flexible: false,
);
enum ExplicitFooTag {
$unknown,
s, // 0x2
i, // 0x1
}
const Map<int, ExplicitFooTag> _ExplicitFooTag_map = {
2: ExplicitFooTag.s,
1: ExplicitFooTag.i,
};
class ExplicitFoo extends $fidl.XUnion {
const ExplicitFoo.withS(String value)
: _ordinal = 2,
_data = value;
const ExplicitFoo.withI(int value)
: _ordinal = 1,
_data = value;
ExplicitFoo._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
ExplicitFooTag get $tag {
final ExplicitFooTag $rawtag = _ExplicitFooTag_map[_ordinal];
return $rawtag == null ? ExplicitFooTag.$unknown : $rawtag;
}
String get s {
if (_ordinal != 2) {
return null;
}
return _data;
}
int get i {
if (_ordinal != 1) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 2:
return 'ExplicitFoo.s($s)';
case 1:
return 'ExplicitFoo.i($i)';
default:
return 'ExplicitFoo.<UNKNOWN>';
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static ExplicitFoo _ctor(int ordinal, Object data) {
return ExplicitFoo._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<ExplicitFoo> kExplicitFoo_Type =
$fidl.XUnionType<ExplicitFoo>(
members: <int, $fidl.FidlType>{
2: $fidl.StringType(maybeElementCount: null, nullable: false),
1: $fidl.Int32Type(),
},
ctor: ExplicitFoo._ctor,
nullable: false,
flexible: true,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<ExplicitFoo> kExplicitFoo_OptType =
$fidl.XUnionType<ExplicitFoo>(
members: <int, $fidl.FidlType>{
2: $fidl.StringType(maybeElementCount: null, nullable: false),
1: $fidl.Int32Type(),
},
ctor: ExplicitFoo._ctor,
nullable: true,
flexible: true,
);
enum ExplicitStrictFooTag {
s, // 0x3
i, // 0x2
}
const Map<int, ExplicitStrictFooTag> _ExplicitStrictFooTag_map = {
3: ExplicitStrictFooTag.s,
2: ExplicitStrictFooTag.i,
};
class ExplicitStrictFoo extends $fidl.XUnion {
const ExplicitStrictFoo.withS(String value)
: _ordinal = 3,
_data = value;
const ExplicitStrictFoo.withI(int value)
: _ordinal = 2,
_data = value;
ExplicitStrictFoo._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
ExplicitStrictFooTag get $tag => _ExplicitStrictFooTag_map[_ordinal];
String get s {
if (_ordinal != 3) {
return null;
}
return _data;
}
int get i {
if (_ordinal != 2) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 3:
return 'ExplicitStrictFoo.s($s)';
case 2:
return 'ExplicitStrictFoo.i($i)';
default:
return null;
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static ExplicitStrictFoo _ctor(int ordinal, Object data) {
return ExplicitStrictFoo._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<ExplicitStrictFoo> kExplicitStrictFoo_Type =
$fidl.XUnionType<ExplicitStrictFoo>(
members: <int, $fidl.FidlType>{
3: $fidl.StringType(maybeElementCount: null, nullable: false),
2: $fidl.Int32Type(),
},
ctor: ExplicitStrictFoo._ctor,
nullable: false,
flexible: false,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<ExplicitStrictFoo> kExplicitStrictFoo_OptType =
$fidl.XUnionType<ExplicitStrictFoo>(
members: <int, $fidl.FidlType>{
3: $fidl.StringType(maybeElementCount: null, nullable: false),
2: $fidl.Int32Type(),
},
ctor: ExplicitStrictFoo._ctor,
nullable: true,
flexible: false,
);
enum OlderSimpleUnionTag {
$unknown,
i, // 0x1
f, // 0x2
}
const Map<int, OlderSimpleUnionTag> _OlderSimpleUnionTag_map = {
1: OlderSimpleUnionTag.i,
2: OlderSimpleUnionTag.f,
};
class OlderSimpleUnion extends $fidl.XUnion {
const OlderSimpleUnion.withI(int value)
: _ordinal = 1,
_data = value;
const OlderSimpleUnion.withF(double value)
: _ordinal = 2,
_data = value;
OlderSimpleUnion._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
OlderSimpleUnionTag get $tag {
final OlderSimpleUnionTag $rawtag = _OlderSimpleUnionTag_map[_ordinal];
return $rawtag == null ? OlderSimpleUnionTag.$unknown : $rawtag;
}
int get i {
if (_ordinal != 1) {
return null;
}
return _data;
}
double get f {
if (_ordinal != 2) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 1:
return 'OlderSimpleUnion.i($i)';
case 2:
return 'OlderSimpleUnion.f($f)';
default:
return 'OlderSimpleUnion.<UNKNOWN>';
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static OlderSimpleUnion _ctor(int ordinal, Object data) {
return OlderSimpleUnion._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<OlderSimpleUnion> kOlderSimpleUnion_Type =
$fidl.XUnionType<OlderSimpleUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.Int64Type(),
2: $fidl.Float32Type(),
},
ctor: OlderSimpleUnion._ctor,
nullable: false,
flexible: true,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<OlderSimpleUnion> kOlderSimpleUnion_OptType =
$fidl.XUnionType<OlderSimpleUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.Int64Type(),
2: $fidl.Float32Type(),
},
ctor: OlderSimpleUnion._ctor,
nullable: true,
flexible: true,
);
enum NewerSimpleUnionTag {
$unknown,
i, // 0x1
s, // 0x2
v, // 0x3
}
const Map<int, NewerSimpleUnionTag> _NewerSimpleUnionTag_map = {
1: NewerSimpleUnionTag.i,
2: NewerSimpleUnionTag.s,
3: NewerSimpleUnionTag.v,
};
class NewerSimpleUnion extends $fidl.XUnion {
const NewerSimpleUnion.withI(int value)
: _ordinal = 1,
_data = value;
const NewerSimpleUnion.withS(String value)
: _ordinal = 2,
_data = value;
const NewerSimpleUnion.withV(List<String> value)
: _ordinal = 3,
_data = value;
NewerSimpleUnion._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
NewerSimpleUnionTag get $tag {
final NewerSimpleUnionTag $rawtag = _NewerSimpleUnionTag_map[_ordinal];
return $rawtag == null ? NewerSimpleUnionTag.$unknown : $rawtag;
}
int get i {
if (_ordinal != 1) {
return null;
}
return _data;
}
String get s {
if (_ordinal != 2) {
return null;
}
return _data;
}
List<String> get v {
if (_ordinal != 3) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 1:
return 'NewerSimpleUnion.i($i)';
case 2:
return 'NewerSimpleUnion.s($s)';
case 3:
return 'NewerSimpleUnion.v($v)';
default:
return 'NewerSimpleUnion.<UNKNOWN>';
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static NewerSimpleUnion _ctor(int ordinal, Object data) {
return NewerSimpleUnion._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<NewerSimpleUnion> kNewerSimpleUnion_Type =
$fidl.XUnionType<NewerSimpleUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.Int64Type(),
2: $fidl.StringType(maybeElementCount: null, nullable: false),
3: $fidl.VectorType<List<String>>(
element: $fidl.StringType(maybeElementCount: null, nullable: false),
maybeElementCount: null,
nullable: false),
},
ctor: NewerSimpleUnion._ctor,
nullable: false,
flexible: true,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<NewerSimpleUnion> kNewerSimpleUnion_OptType =
$fidl.XUnionType<NewerSimpleUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.Int64Type(),
2: $fidl.StringType(maybeElementCount: null, nullable: false),
3: $fidl.VectorType<List<String>>(
element: $fidl.StringType(maybeElementCount: null, nullable: false),
maybeElementCount: null,
nullable: false),
},
ctor: NewerSimpleUnion._ctor,
nullable: true,
flexible: true,
);
enum StrictSimpleXUnionTag {
i, // 0x1
f, // 0x2
s, // 0x3
}
const Map<int, StrictSimpleXUnionTag> _StrictSimpleXUnionTag_map = {
1: StrictSimpleXUnionTag.i,
2: StrictSimpleXUnionTag.f,
3: StrictSimpleXUnionTag.s,
};
class StrictSimpleXUnion extends $fidl.XUnion {
const StrictSimpleXUnion.withI(int value)
: _ordinal = 1,
_data = value;
const StrictSimpleXUnion.withF(double value)
: _ordinal = 2,
_data = value;
const StrictSimpleXUnion.withS(String value)
: _ordinal = 3,
_data = value;
StrictSimpleXUnion._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
StrictSimpleXUnionTag get $tag => _StrictSimpleXUnionTag_map[_ordinal];
int get i {
if (_ordinal != 1) {
return null;
}
return _data;
}
double get f {
if (_ordinal != 2) {
return null;
}
return _data;
}
String get s {
if (_ordinal != 3) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 1:
return 'StrictSimpleXUnion.i($i)';
case 2:
return 'StrictSimpleXUnion.f($f)';
case 3:
return 'StrictSimpleXUnion.s($s)';
default:
return null;
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static StrictSimpleXUnion _ctor(int ordinal, Object data) {
return StrictSimpleXUnion._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<StrictSimpleXUnion> kStrictSimpleXUnion_Type =
$fidl.XUnionType<StrictSimpleXUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.Int32Type(),
2: $fidl.Float32Type(),
3: $fidl.StringType(maybeElementCount: null, nullable: false),
},
ctor: StrictSimpleXUnion._ctor,
nullable: false,
flexible: false,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<StrictSimpleXUnion> kStrictSimpleXUnion_OptType =
$fidl.XUnionType<StrictSimpleXUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.Int32Type(),
2: $fidl.Float32Type(),
3: $fidl.StringType(maybeElementCount: null, nullable: false),
},
ctor: StrictSimpleXUnion._ctor,
nullable: true,
flexible: false,
);
enum XUnionContainingEmptyStructTag {
$unknown,
empty, // 0x1
}
const Map<int, XUnionContainingEmptyStructTag>
_XUnionContainingEmptyStructTag_map = {
1: XUnionContainingEmptyStructTag.empty,
};
class XUnionContainingEmptyStruct extends $fidl.XUnion {
const XUnionContainingEmptyStruct.withEmpty(Empty value)
: _ordinal = 1,
_data = value;
XUnionContainingEmptyStruct._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
XUnionContainingEmptyStructTag get $tag {
final XUnionContainingEmptyStructTag $rawtag =
_XUnionContainingEmptyStructTag_map[_ordinal];
return $rawtag == null ? XUnionContainingEmptyStructTag.$unknown : $rawtag;
}
Empty get empty {
if (_ordinal != 1) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 1:
return 'XUnionContainingEmptyStruct.empty($empty)';
default:
return 'XUnionContainingEmptyStruct.<UNKNOWN>';
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static XUnionContainingEmptyStruct _ctor(int ordinal, Object data) {
return XUnionContainingEmptyStruct._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<XUnionContainingEmptyStruct>
kXUnionContainingEmptyStruct_Type =
$fidl.XUnionType<XUnionContainingEmptyStruct>(
members: <int, $fidl.FidlType>{
1: kEmpty_Type,
},
ctor: XUnionContainingEmptyStruct._ctor,
nullable: false,
flexible: true,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<XUnionContainingEmptyStruct>
kXUnionContainingEmptyStruct_OptType =
$fidl.XUnionType<XUnionContainingEmptyStruct>(
members: <int, $fidl.FidlType>{
1: kEmpty_Type,
},
ctor: XUnionContainingEmptyStruct._ctor,
nullable: true,
flexible: true,
);
enum StrictBoundedXUnionTag {
v, // 0x1
}
const Map<int, StrictBoundedXUnionTag> _StrictBoundedXUnionTag_map = {
1: StrictBoundedXUnionTag.v,
};
class StrictBoundedXUnion extends $fidl.XUnion {
const StrictBoundedXUnion.withV(Uint8List value)
: _ordinal = 1,
_data = value;
StrictBoundedXUnion._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
StrictBoundedXUnionTag get $tag => _StrictBoundedXUnionTag_map[_ordinal];
Uint8List get v {
if (_ordinal != 1) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 1:
return 'StrictBoundedXUnion.v($v)';
default:
return null;
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static StrictBoundedXUnion _ctor(int ordinal, Object data) {
return StrictBoundedXUnion._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<StrictBoundedXUnion> kStrictBoundedXUnion_Type =
$fidl.XUnionType<StrictBoundedXUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.VectorType<Uint8List>(
element: $fidl.Uint8Type(), maybeElementCount: 10, nullable: false),
},
ctor: StrictBoundedXUnion._ctor,
nullable: false,
flexible: false,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<StrictBoundedXUnion> kStrictBoundedXUnion_OptType =
$fidl.XUnionType<StrictBoundedXUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.VectorType<Uint8List>(
element: $fidl.Uint8Type(), maybeElementCount: 10, nullable: false),
},
ctor: StrictBoundedXUnion._ctor,
nullable: true,
flexible: false,
);
enum ExplicitXUnionTag {
$unknown,
i, // 0x1
f, // 0x4
}
const Map<int, ExplicitXUnionTag> _ExplicitXUnionTag_map = {
1: ExplicitXUnionTag.i,
4: ExplicitXUnionTag.f,
};
class ExplicitXUnion extends $fidl.XUnion {
const ExplicitXUnion.withI(int value)
: _ordinal = 1,
_data = value;
const ExplicitXUnion.withF(double value)
: _ordinal = 4,
_data = value;
ExplicitXUnion._(int ordinal, Object data)
: _ordinal = ordinal,
_data = data;
final int _ordinal;
final _data;
ExplicitXUnionTag get $tag {
final ExplicitXUnionTag $rawtag = _ExplicitXUnionTag_map[_ordinal];
return $rawtag == null ? ExplicitXUnionTag.$unknown : $rawtag;
}
int get i {
if (_ordinal != 1) {
return null;
}
return _data;
}
double get f {
if (_ordinal != 4) {
return null;
}
return _data;
}
@override
String toString() {
switch (_ordinal) {
case 1:
return 'ExplicitXUnion.i($i)';
case 4:
return 'ExplicitXUnion.f($f)';
default:
return 'ExplicitXUnion.<UNKNOWN>';
}
}
@override
int get $ordinal => _ordinal;
@override
Object get $data => _data;
static ExplicitXUnion _ctor(int ordinal, Object data) {
return ExplicitXUnion._(ordinal, data);
}
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<ExplicitXUnion> kExplicitXUnion_Type =
$fidl.XUnionType<ExplicitXUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.Int64Type(),
4: $fidl.Float32Type(),
},
ctor: ExplicitXUnion._ctor,
nullable: false,
flexible: true,
);
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.XUnionType<ExplicitXUnion> kExplicitXUnion_OptType =
$fidl.XUnionType<ExplicitXUnion>(
members: <int, $fidl.FidlType>{
1: $fidl.Int64Type(),
4: $fidl.Float32Type(),
},
ctor: ExplicitXUnion._ctor,
nullable: true,
flexible: true,
);
class Empty extends $fidl.Struct {
const Empty({
this.reserved: 0x0,
});
Empty.clone(
Empty $orig, {
int reserved,
}) : this(
reserved: reserved ?? $orig.reserved,
);
Empty._(List<Object> argv) : reserved = argv[0];
final int reserved;
@override
List<Object> get $fields {
return <Object>[
reserved,
];
}
@override
String toString() {
// ignore: prefer_interpolation_to_compose_strings
return r'Empty' r'(reserved: ' + reserved.toString() + r')';
}
static Empty _ctor(List<Object> argv) => Empty._(argv);
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.StructType<Empty> kEmpty_Type = $fidl.StructType<Empty>(
inlineSize: 1,
members: <$fidl.MemberType>[
$fidl.MemberType<int>(type: $fidl.Uint8Type(), offset: 0),
],
ctor: Empty._ctor,
);
class StructWithNullableXUnion extends $fidl.Struct {
const StructWithNullableXUnion({
this.x1,
});
StructWithNullableXUnion.clone(
StructWithNullableXUnion $orig, {
OlderSimpleUnion x1,
}) : this(
x1: x1 ?? $orig.x1,
);
StructWithNullableXUnion.cloneWithout(
StructWithNullableXUnion $orig, {
bool x1,
}) : this(
x1: x1 ? null : $orig.x1,
);
StructWithNullableXUnion._(List<Object> argv) : x1 = argv[0];
final OlderSimpleUnion x1;
@override
List<Object> get $fields {
return <Object>[
x1,
];
}
@override
String toString() {
// ignore: prefer_interpolation_to_compose_strings
return r'StructWithNullableXUnion' r'(x1: ' + x1.toString() + r')';
}
static StructWithNullableXUnion _ctor(List<Object> argv) =>
StructWithNullableXUnion._(argv);
}
// See FIDL-308:
// ignore: recursive_compile_time_constant
const $fidl.StructType<StructWithNullableXUnion>
kStructWithNullableXUnion_Type = $fidl.StructType<StructWithNullableXUnion>(
inlineSize: 24,
members: <$fidl.MemberType>[
$fidl.MemberType<OlderSimpleUnion>(
type: kOlderSimpleUnion_OptType, offset: 0),
],
ctor: StructWithNullableXUnion._ctor,
);
// ignore: unused_element, avoid_private_typedef_functions
typedef _VoidCallback = void Function();
// strictXUnionHenceResponseMayBeStackAllocated: () -> (StrictBoundedXUnion xu)
const int _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal =
0x68bfe80f00000000;
const int
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal =
0x728fedeed6ef99da;
const $fidl.MethodType
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type =
$fidl.MethodType(
request: null,
response: <$fidl.MemberType>[
$fidl.MemberType<StrictBoundedXUnion>(
type: kStrictBoundedXUnion_Type, offset: 0),
],
name: r"TestProtocol.StrictXUnionHenceResponseMayBeStackAllocated",
requestInlineSize: 0,
responseInlineSize: 24,
);
// flexibleXUnionHenceResponseMustBeHeapAllocated: () -> (OlderSimpleUnion xu)
const int
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal =
0x176e085800000000;
const int
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal =
0xfd2ba0109faffe3;
const $fidl.MethodType
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type =
$fidl.MethodType(
request: null,
response: <$fidl.MemberType>[
$fidl.MemberType<OlderSimpleUnion>(type: kOlderSimpleUnion_Type, offset: 0),
],
name: r"TestProtocol.FlexibleXUnionHenceResponseMustBeHeapAllocated",
requestInlineSize: 0,
responseInlineSize: 24,
);
abstract class TestProtocol extends $fidl.Service {
static const String $serviceName = null;
@override
$fidl.ServiceData get $serviceData => TestProtocolData();
$async.Future<StrictBoundedXUnion>
strictXUnionHenceResponseMayBeStackAllocated();
$async.Future<OlderSimpleUnion>
flexibleXUnionHenceResponseMustBeHeapAllocated();
}
class TestProtocolData implements $fidl.ServiceData<TestProtocol> {
const TestProtocolData();
@override
String getName() {
return TestProtocol.$serviceName;
}
@override
$fidl.AsyncBinding getBinding() {
return TestProtocolBinding();
}
}
class TestProtocolProxy extends $fidl.AsyncProxy<TestProtocol>
implements TestProtocol {
TestProtocolProxy()
: super($fidl.AsyncProxyController<TestProtocol>(
$serviceName: null, $interfaceName: r'TestProtocol')) {
ctrl.onResponse = _handleResponse;
}
@override
$fidl.ServiceData get $serviceData => TestProtocolData();
void _handleEvent($fidl.Message $message) {
final $fidl.Decoder $decoder = $fidl.Decoder($message)
..claimMemory($fidl.kMessageHeaderSize);
switch ($message.ordinal) {
default:
ctrl.proxyError(
$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 $async.Completer $completer = ctrl.getCompleter($txid);
if ($completer == null) {
$message.closeHandles();
return;
}
final $fidl.Decoder $decoder = $fidl.Decoder($message)
..claimMemory($fidl.kMessageHeaderSize);
switch ($message.ordinal) {
case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal:
case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal:
final String _name =
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
.name;
try {
Timeline.startSync(_name);
final List<$fidl.MemberType> $types =
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
.response;
$decoder.claimMemory(
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
.decodeResponseInlineSize($decoder));
// ignore: prefer_const_declarations
final $response =
$types[0].decode($decoder, $fidl.kMessageHeaderSize);
$completer.complete($response);
// ignore: avoid_catches_without_on_clauses
} catch (_e) {
ctrl.proxyError($fidl.FidlError(
'Exception handling method response $_name: $_e'));
ctrl.close();
rethrow;
} finally {
Timeline.finishSync();
}
break;
case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal:
case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal:
final String _name =
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
.name;
try {
Timeline.startSync(_name);
final List<$fidl.MemberType> $types =
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
.response;
$decoder.claimMemory(
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
.decodeResponseInlineSize($decoder));
// ignore: prefer_const_declarations
final $response =
$types[0].decode($decoder, $fidl.kMessageHeaderSize);
$completer.complete($response);
// ignore: avoid_catches_without_on_clauses
} catch (_e) {
ctrl.proxyError($fidl.FidlError(
'Exception handling method response $_name: $_e'));
ctrl.close();
rethrow;
} finally {
Timeline.finishSync();
}
break;
default:
ctrl.proxyError(
$fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
@override
$async.Future<StrictBoundedXUnion>
strictXUnionHenceResponseMayBeStackAllocated() async {
if (!ctrl.isBound) {
return $async.Future.error(
$fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'),
StackTrace.current);
}
final $fidl.Encoder $encoder = $fidl.Encoder();
$encoder.encodeMessageHeader(
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal,
0);
final $completer = $async.Completer<StrictBoundedXUnion>();
ctrl.sendMessageWithResponse($encoder.message, $completer);
return $completer.future;
}
@override
$async.Future<OlderSimpleUnion>
flexibleXUnionHenceResponseMustBeHeapAllocated() async {
if (!ctrl.isBound) {
return $async.Future.error(
$fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'),
StackTrace.current);
}
final $fidl.Encoder $encoder = $fidl.Encoder();
$encoder.encodeMessageHeader(
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal,
0);
final $completer = $async.Completer<OlderSimpleUnion>();
ctrl.sendMessageWithResponse($encoder.message, $completer);
return $completer.future;
}
}
class TestProtocolBinding extends $fidl.AsyncBinding<TestProtocol> {
TestProtocolBinding() : super(r"TestProtocol");
@override
void handleMessage($fidl.Message $message, $fidl.MessageSink $respond) {
final $fidl.Decoder $decoder = $fidl.Decoder($message)
..claimMemory($fidl.kMessageHeaderSize);
switch ($message.ordinal) {
case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal:
case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal:
final String _name =
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
.name;
try {
Timeline.startSync(_name);
final List<$fidl.MemberType> $types =
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
.request;
$decoder.claimMemory(
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
.decodeRequestInlineSize($decoder));
final $async.Future<StrictBoundedXUnion> $future =
impl.strictXUnionHenceResponseMayBeStackAllocated();
$future.then(($response) {
final $fidl.Encoder $encoder = $fidl.Encoder();
$encoder.encodeMessageHeader(
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal,
$message.txid);
$encoder.alloc(
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
.encodingResponseInlineSize($encoder));
final List<$fidl.MemberType> $types =
_kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
.response;
$types[0].encode($encoder, $response, $fidl.kMessageHeaderSize);
$respond($encoder.message);
}, onError: (_e) {
close();
print('Exception handling method call $_name: $_e');
});
// ignore: avoid_catches_without_on_clauses
} catch (_e) {
close();
print('Exception handling method call $_name: $_e');
rethrow;
} finally {
Timeline.finishSync();
}
break;
case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal:
case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal:
final String _name =
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
.name;
try {
Timeline.startSync(_name);
final List<$fidl.MemberType> $types =
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
.request;
$decoder.claimMemory(
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
.decodeRequestInlineSize($decoder));
final $async.Future<OlderSimpleUnion> $future =
impl.flexibleXUnionHenceResponseMustBeHeapAllocated();
$future.then(($response) {
final $fidl.Encoder $encoder = $fidl.Encoder();
$encoder.encodeMessageHeader(
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal,
$message.txid);
$encoder.alloc(
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
.encodingResponseInlineSize($encoder));
final List<$fidl.MemberType> $types =
_kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
.response;
$types[0].encode($encoder, $response, $fidl.kMessageHeaderSize);
$respond($encoder.message);
}, onError: (_e) {
close();
print('Exception handling method call $_name: $_e');
});
// ignore: avoid_catches_without_on_clauses
} catch (_e) {
close();
print('Exception handling method call $_name: $_e');
rethrow;
} finally {
Timeline.finishSync();
}
break;
default:
throw $fidl.FidlError(
r'Unexpected message name for TestProtocolBinding');
}
}
}