<|start_filename|>example/route_guide/lib/src/generated/route_guide.pb.dart<|end_filename|>
///
//  Generated code. Do not modify.
//  source: route_guide.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields

import 'dart:core' as $core;

import 'package:protobuf/protobuf.dart' as $pb;

class Point extends $pb.GeneratedMessage {
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      const $core.bool.fromEnvironment('protobuf.omit_message_names')
          ? ''
          : 'Point',
      package: const $pb.PackageName(
          const $core.bool.fromEnvironment('protobuf.omit_message_names')
              ? ''
              : 'routeguide'),
      createEmptyInstance: create)
    ..a<$core.int>(
        1,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'latitude',
        $pb.PbFieldType.O3)
    ..a<$core.int>(
        2,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'longitude',
        $pb.PbFieldType.O3)
    ..hasRequiredFields = false;

  Point._() : super();
  factory Point({
    $core.int? latitude,
    $core.int? longitude,
  }) {
    final _result = create();
    if (latitude != null) {
      _result.latitude = latitude;
    }
    if (longitude != null) {
      _result.longitude = longitude;
    }
    return _result;
  }
  factory Point.fromBuffer($core.List<$core.int> i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(i, r);
  factory Point.fromJson($core.String i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(i, r);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
      'Will be removed in next major version')
  Point clone() => Point()..mergeFromMessage(this);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
      'Will be removed in next major version')
  Point copyWith(void Function(Point) updates) =>
      super.copyWith((message) => updates(message as Point))
          as Point; // ignore: deprecated_member_use
  $pb.BuilderInfo get info_ => _i;
  @$core.pragma('dart2js:noInline')
  static Point create() => Point._();
  Point createEmptyInstance() => create();
  static $pb.PbList<Point> createRepeated() => $pb.PbList<Point>();
  @$core.pragma('dart2js:noInline')
  static Point getDefault() =>
      _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Point>(create);
  static Point? _defaultInstance;

  @$pb.TagNumber(1)
  $core.int get latitude => $_getIZ(0);
  @$pb.TagNumber(1)
  set latitude($core.int v) {
    $_setSignedInt32(0, v);
  }

  @$pb.TagNumber(1)
  $core.bool hasLatitude() => $_has(0);
  @$pb.TagNumber(1)
  void clearLatitude() => clearField(1);

  @$pb.TagNumber(2)
  $core.int get longitude => $_getIZ(1);
  @$pb.TagNumber(2)
  set longitude($core.int v) {
    $_setSignedInt32(1, v);
  }

  @$pb.TagNumber(2)
  $core.bool hasLongitude() => $_has(1);
  @$pb.TagNumber(2)
  void clearLongitude() => clearField(2);
}

class Rectangle extends $pb.GeneratedMessage {
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      const $core.bool.fromEnvironment('protobuf.omit_message_names')
          ? ''
          : 'Rectangle',
      package: const $pb.PackageName(
          const $core.bool.fromEnvironment('protobuf.omit_message_names')
              ? ''
              : 'routeguide'),
      createEmptyInstance: create)
    ..aOM<Point>(
        1,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'lo',
        subBuilder: Point.create)
    ..aOM<Point>(
        2,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'hi',
        subBuilder: Point.create)
    ..hasRequiredFields = false;

  Rectangle._() : super();
  factory Rectangle({
    Point? lo,
    Point? hi,
  }) {
    final _result = create();
    if (lo != null) {
      _result.lo = lo;
    }
    if (hi != null) {
      _result.hi = hi;
    }
    return _result;
  }
  factory Rectangle.fromBuffer($core.List<$core.int> i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(i, r);
  factory Rectangle.fromJson($core.String i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(i, r);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
      'Will be removed in next major version')
  Rectangle clone() => Rectangle()..mergeFromMessage(this);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
      'Will be removed in next major version')
  Rectangle copyWith(void Function(Rectangle) updates) =>
      super.copyWith((message) => updates(message as Rectangle))
          as Rectangle; // ignore: deprecated_member_use
  $pb.BuilderInfo get info_ => _i;
  @$core.pragma('dart2js:noInline')
  static Rectangle create() => Rectangle._();
  Rectangle createEmptyInstance() => create();
  static $pb.PbList<Rectangle> createRepeated() => $pb.PbList<Rectangle>();
  @$core.pragma('dart2js:noInline')
  static Rectangle getDefault() =>
      _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Rectangle>(create);
  static Rectangle? _defaultInstance;

  @$pb.TagNumber(1)
  Point get lo => $_getN(0);
  @$pb.TagNumber(1)
  set lo(Point v) {
    setField(1, v);
  }

  @$pb.TagNumber(1)
  $core.bool hasLo() => $_has(0);
  @$pb.TagNumber(1)
  void clearLo() => clearField(1);
  @$pb.TagNumber(1)
  Point ensureLo() => $_ensure(0);

  @$pb.TagNumber(2)
  Point get hi => $_getN(1);
  @$pb.TagNumber(2)
  set hi(Point v) {
    setField(2, v);
  }

  @$pb.TagNumber(2)
  $core.bool hasHi() => $_has(1);
  @$pb.TagNumber(2)
  void clearHi() => clearField(2);
  @$pb.TagNumber(2)
  Point ensureHi() => $_ensure(1);
}

class Feature extends $pb.GeneratedMessage {
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      const $core.bool.fromEnvironment('protobuf.omit_message_names')
          ? ''
          : 'Feature',
      package: const $pb.PackageName(
          const $core.bool.fromEnvironment('protobuf.omit_message_names')
              ? ''
              : 'routeguide'),
      createEmptyInstance: create)
    ..aOS(
        1,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'name')
    ..aOM<Point>(
        2,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'location',
        subBuilder: Point.create)
    ..hasRequiredFields = false;

  Feature._() : super();
  factory Feature({
    $core.String? name,
    Point? location,
  }) {
    final _result = create();
    if (name != null) {
      _result.name = name;
    }
    if (location != null) {
      _result.location = location;
    }
    return _result;
  }
  factory Feature.fromBuffer($core.List<$core.int> i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(i, r);
  factory Feature.fromJson($core.String i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(i, r);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
      'Will be removed in next major version')
  Feature clone() => Feature()..mergeFromMessage(this);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
      'Will be removed in next major version')
  Feature copyWith(void Function(Feature) updates) =>
      super.copyWith((message) => updates(message as Feature))
          as Feature; // ignore: deprecated_member_use
  $pb.BuilderInfo get info_ => _i;
  @$core.pragma('dart2js:noInline')
  static Feature create() => Feature._();
  Feature createEmptyInstance() => create();
  static $pb.PbList<Feature> createRepeated() => $pb.PbList<Feature>();
  @$core.pragma('dart2js:noInline')
  static Feature getDefault() =>
      _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Feature>(create);
  static Feature? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get name => $_getSZ(0);
  @$pb.TagNumber(1)
  set name($core.String v) {
    $_setString(0, v);
  }

  @$pb.TagNumber(1)
  $core.bool hasName() => $_has(0);
  @$pb.TagNumber(1)
  void clearName() => clearField(1);

  @$pb.TagNumber(2)
  Point get location => $_getN(1);
  @$pb.TagNumber(2)
  set location(Point v) {
    setField(2, v);
  }

  @$pb.TagNumber(2)
  $core.bool hasLocation() => $_has(1);
  @$pb.TagNumber(2)
  void clearLocation() => clearField(2);
  @$pb.TagNumber(2)
  Point ensureLocation() => $_ensure(1);
}

class RouteNote extends $pb.GeneratedMessage {
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      const $core.bool.fromEnvironment('protobuf.omit_message_names')
          ? ''
          : 'RouteNote',
      package: const $pb.PackageName(
          const $core.bool.fromEnvironment('protobuf.omit_message_names')
              ? ''
              : 'routeguide'),
      createEmptyInstance: create)
    ..aOM<Point>(
        1,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'location',
        subBuilder: Point.create)
    ..aOS(
        2,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'message')
    ..hasRequiredFields = false;

  RouteNote._() : super();
  factory RouteNote({
    Point? location,
    $core.String? message,
  }) {
    final _result = create();
    if (location != null) {
      _result.location = location;
    }
    if (message != null) {
      _result.message = message;
    }
    return _result;
  }
  factory RouteNote.fromBuffer($core.List<$core.int> i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(i, r);
  factory RouteNote.fromJson($core.String i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(i, r);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
      'Will be removed in next major version')
  RouteNote clone() => RouteNote()..mergeFromMessage(this);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
      'Will be removed in next major version')
  RouteNote copyWith(void Function(RouteNote) updates) =>
      super.copyWith((message) => updates(message as RouteNote))
          as RouteNote; // ignore: deprecated_member_use
  $pb.BuilderInfo get info_ => _i;
  @$core.pragma('dart2js:noInline')
  static RouteNote create() => RouteNote._();
  RouteNote createEmptyInstance() => create();
  static $pb.PbList<RouteNote> createRepeated() => $pb.PbList<RouteNote>();
  @$core.pragma('dart2js:noInline')
  static RouteNote getDefault() =>
      _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RouteNote>(create);
  static RouteNote? _defaultInstance;

  @$pb.TagNumber(1)
  Point get location => $_getN(0);
  @$pb.TagNumber(1)
  set location(Point v) {
    setField(1, v);
  }

  @$pb.TagNumber(1)
  $core.bool hasLocation() => $_has(0);
  @$pb.TagNumber(1)
  void clearLocation() => clearField(1);
  @$pb.TagNumber(1)
  Point ensureLocation() => $_ensure(0);

  @$pb.TagNumber(2)
  $core.String get message => $_getSZ(1);
  @$pb.TagNumber(2)
  set message($core.String v) {
    $_setString(1, v);
  }

  @$pb.TagNumber(2)
  $core.bool hasMessage() => $_has(1);
  @$pb.TagNumber(2)
  void clearMessage() => clearField(2);
}

class RouteSummary extends $pb.GeneratedMessage {
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      const $core.bool.fromEnvironment('protobuf.omit_message_names')
          ? ''
          : 'RouteSummary',
      package: const $pb.PackageName(
          const $core.bool.fromEnvironment('protobuf.omit_message_names')
              ? ''
              : 'routeguide'),
      createEmptyInstance: create)
    ..a<$core.int>(
        1,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'pointCount',
        $pb.PbFieldType.O3)
    ..a<$core.int>(
        2,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'featureCount',
        $pb.PbFieldType.O3)
    ..a<$core.int>(
        3,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'distance',
        $pb.PbFieldType.O3)
    ..a<$core.int>(
        4,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'elapsedTime',
        $pb.PbFieldType.O3)
    ..hasRequiredFields = false;

  RouteSummary._() : super();
  factory RouteSummary({
    $core.int? pointCount,
    $core.int? featureCount,
    $core.int? distance,
    $core.int? elapsedTime,
  }) {
    final _result = create();
    if (pointCount != null) {
      _result.pointCount = pointCount;
    }
    if (featureCount != null) {
      _result.featureCount = featureCount;
    }
    if (distance != null) {
      _result.distance = distance;
    }
    if (elapsedTime != null) {
      _result.elapsedTime = elapsedTime;
    }
    return _result;
  }
  factory RouteSummary.fromBuffer($core.List<$core.int> i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(i, r);
  factory RouteSummary.fromJson($core.String i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(i, r);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
      'Will be removed in next major version')
  RouteSummary clone() => RouteSummary()..mergeFromMessage(this);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
      'Will be removed in next major version')
  RouteSummary copyWith(void Function(RouteSummary) updates) =>
      super.copyWith((message) => updates(message as RouteSummary))
          as RouteSummary; // ignore: deprecated_member_use
  $pb.BuilderInfo get info_ => _i;
  @$core.pragma('dart2js:noInline')
  static RouteSummary create() => RouteSummary._();
  RouteSummary createEmptyInstance() => create();
  static $pb.PbList<RouteSummary> createRepeated() =>
      $pb.PbList<RouteSummary>();
  @$core.pragma('dart2js:noInline')
  static RouteSummary getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<RouteSummary>(create);
  static RouteSummary? _defaultInstance;

  @$pb.TagNumber(1)
  $core.int get pointCount => $_getIZ(0);
  @$pb.TagNumber(1)
  set pointCount($core.int v) {
    $_setSignedInt32(0, v);
  }

  @$pb.TagNumber(1)
  $core.bool hasPointCount() => $_has(0);
  @$pb.TagNumber(1)
  void clearPointCount() => clearField(1);

  @$pb.TagNumber(2)
  $core.int get featureCount => $_getIZ(1);
  @$pb.TagNumber(2)
  set featureCount($core.int v) {
    $_setSignedInt32(1, v);
  }

  @$pb.TagNumber(2)
  $core.bool hasFeatureCount() => $_has(1);
  @$pb.TagNumber(2)
  void clearFeatureCount() => clearField(2);

  @$pb.TagNumber(3)
  $core.int get distance => $_getIZ(2);
  @$pb.TagNumber(3)
  set distance($core.int v) {
    $_setSignedInt32(2, v);
  }

  @$pb.TagNumber(3)
  $core.bool hasDistance() => $_has(2);
  @$pb.TagNumber(3)
  void clearDistance() => clearField(3);

  @$pb.TagNumber(4)
  $core.int get elapsedTime => $_getIZ(3);
  @$pb.TagNumber(4)
  set elapsedTime($core.int v) {
    $_setSignedInt32(3, v);
  }

  @$pb.TagNumber(4)
  $core.bool hasElapsedTime() => $_has(3);
  @$pb.TagNumber(4)
  void clearElapsedTime() => clearField(4);
}


<|start_filename|>interop/lib/src/client.dart<|end_filename|>
// Copyright (c) 2017, the gRPC project authors. Please see the AUTHORS file
// for details. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'dart:async';
import 'dart:io';
import 'dart:typed_data';

import 'package:collection/collection.dart';
import 'package:grpc/grpc.dart';

import 'generated/empty.pb.dart';
import 'generated/messages.pb.dart';
import 'generated/test.pbgrpc.dart';

const _headerEchoKey = 'x-grpc-test-echo-initial';
const _headerEchoData = 'test_initial_metadata_value';

const _trailerEchoKey = 'x-grpc-test-echo-trailing-bin';
const _trailerEchoData = 'q6ur'; // 0xababab in base64

class Tester {
  final String serverHost;
  final String? serverHostOverride;
  final int serverPort;
  final String testCase;
  final bool useTls;
  final bool useTestCA;
  final String? defaultServiceAccount;
  final String? oauthScope;
  final String? serviceAccountKeyFile;
  String? _serviceAccountJson;

  Tester(
      {required this.serverHost,
      required this.serverHostOverride,
      required this.serverPort,
      required this.testCase,
      required this.useTls,
      required this.useTestCA,
      required this.defaultServiceAccount,
      required this.oauthScope,
      required this.serviceAccountKeyFile});

  String get serviceAccountJson =>
      _serviceAccountJson ??= _readServiceAccountJson();

  String _readServiceAccountJson() {
    if (serviceAccountKeyFile?.isEmpty ?? true) {
      throw 'Service account key file not specified.';
    }
    return File(serviceAccountKeyFile!).readAsStringSync();
  }

  late final ClientChannel channel;
  late final TestServiceClient client;
  late final UnimplementedServiceClient unimplementedServiceClient;

  Future<void> runTest() async {
    ChannelCredentials credentials;
    if (useTls) {
      List<int>? trustedRoot;
      if (useTestCA) {
        trustedRoot = File('ca.pem').readAsBytesSync();
      }
      credentials = ChannelCredentials.secure(
          certificates: trustedRoot, authority: serverHostOverride);
    } else {
      credentials = const ChannelCredentials.insecure();
    }

    final options = ChannelOptions(credentials: credentials);
    channel = ClientChannel(serverHost, port: serverPort, options: options);
    client = TestServiceClient(channel);
    unimplementedServiceClient = UnimplementedServiceClient(channel);
    await runTestCase();
    await channel.shutdown();
  }

  Future<void> runTestCase() async {
    switch (testCase) {
      case 'empty_unary':
        return emptyUnary();
      case 'cacheable_unary':
        return cacheableUnary();
      case 'large_unary':
        return largeUnary();
      case 'client_compressed_unary':
        return clientCompressedUnary();
      case 'server_compressed_unary':
        return serverCompressedUnary();
      case 'client_streaming':
        return clientStreaming();
      case 'client_compressed_streaming':
        return clientCompressedStreaming();
      case 'server_streaming':
        return serverStreaming();
      case 'server_compressed_streaming':
        return serverCompressedStreaming();
      case 'ping_pong':
        return pingPong();
      case 'empty_stream':
        return emptyStream();
      case 'compute_engine_creds':
        return computeEngineCreds();
      case 'service_account_creds':
        return serviceAccountCreds();
      case 'jwt_token_creds':
        return jwtTokenCreds();
      case 'oauth2_auth_token':
        return oauth2AuthToken();
      case 'per_rpc_creds':
        return perRpcCreds();
      case 'custom_metadata':
        return customMetadata();
      case 'status_code_and_message':
        return statusCodeAndMessage();
      case 'unimplemented_method':
        return unimplementedMethod();
      case 'unimplemented_service':
        return unimplementedService();
      case 'cancel_after_begin':
        return cancelAfterBegin();
      case 'cancel_after_first_response':
        return cancelAfterFirstResponse();
      case 'timeout_on_sleeping_server':
        return timeoutOnSleepingServer();
      default:
        print('Unknown test case: $testCase');
    }
  }

  /// This test verifies that implementations support zero-size messages.
  /// Ideally, client implementations would verify that the request and response
  /// were zero bytes serialized, but this is generally prohibitive to perform,
  /// so is not required.
  ///
  /// Procedure:
  /// 1. Client calls EmptyCall with the default Empty message
  ///
  /// Client asserts:
  /// * call was successful
  /// * response is non-null
  Future<void> emptyUnary() async {
    await client.emptyCall(Empty());
  }

  /// This test verifies that gRPC requests marked as cacheable use GET verb
  /// instead of POST, and that server sets appropriate cache control headers
  /// for the response to be cached by a proxy. This test requires that the
  /// server is behind a caching proxy. Use of current timestamp in the request
  /// prevents accidental cache matches left over from previous tests.
  ///
  /// Procedure:
  /// 1. Client calls CacheableUnaryCall with `SimpleRequest` request with
  ///    payload set to current timestamp. Timestamp format is irrelevant, and
  ///    resolution is in nanoseconds.
  ///    Client adds a `x-user-ip` header with value `1.2.3.4` to the request.
  ///    This is done since some proxies such as GFE will not cache requests
  ///    from localhost.
  ///    Client marks the request as cacheable by setting the cacheable flag in
  ///    the request context. Longer term this should be driven by the method
  ///    option specified in the proto file itself.
  /// 2. Client calls CacheableUnaryCall again immediately with the same request
  ///    and configuration as the previous call.
  ///
  /// Client asserts:
  /// * Both calls were successful
  /// * The payload body of both responses is the same.
  Future<void> cacheableUnary() async {
    throw 'Not implemented';
  }

  /// This test verifies unary calls succeed in sending messages, and touches on
  /// flow control (even if compression is enabled on the channel).
  ///
  /// Procedure:
  /// 1. Client calls UnaryCall with:
  ///     {
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * response payload body is 314159 bytes in size
  /// * clients are free to assert that the response payload body contents are
  ///   zero and comparing the entire response message against a golden response
  Future<void> largeUnary() async {
    final payload = Payload()..body = Uint8List(271828);
    final request = SimpleRequest()
      ..responseSize = 314159
      ..payload = payload;
    final response = await client.unaryCall(request);
    final receivedBytes = response.payload.body.length;
    if (receivedBytes != 314159) {
      throw 'Response payload mismatch. Expected 314159 bytes, '
          'got ${receivedBytes}.';
    }
  }

  /// This test verifies the client can compress unary messages by sending two
  /// unary calls, for compressed and uncompressed payloads. It also sends an
  /// initial probing request to verify whether the server supports the
  /// CompressedRequest feature by checking if the probing call fails with an
  /// `INVALID_ARGUMENT` status.
  ///
  /// Procedure:
  /// 1. Client calls UnaryCall with the feature probe, an *uncompressed*
  ///    message:
  ///     {
  ///       expect_compressed: {
  ///         value: true
  ///       }
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///     }
  /// 1. Client calls UnaryCall with the *compressed* message:
  ///     {
  ///       expect_compressed: {
  ///         value: true
  ///       }
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///     }
  /// 1. Client calls UnaryCall with the *uncompressed* message:
  ///     {
  ///     expect_compressed: {
  ///         value: false
  ///       }
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///     }
  ///
  /// Client asserts:
  /// * First call failed with `INVALID_ARGUMENT` status.
  /// * Subsequent calls were successful.
  /// * Response payload body is 314159 bytes in size.
  /// * Clients are free to assert that the response payload body contents are
  ///   zeros and comparing the entire response message against a golden
  ///   response.
  Future<void> clientCompressedUnary() async {
    throw 'Not implemented';
  }

  /// This test verifies the server can compress unary messages. It sends two
  /// unary requests, expecting the server's response to be compressed or not
  /// according to the `response_compressed` boolean.
  ///
  /// Whether compression was actually performed is determined by the
  /// compression bit in the response's message flags. *Note that some languages
  /// may not have access to the message flags, in which case the client will be
  /// unable to verify that the `response_compressed` boolean is obeyed by the
  /// server*.
  ///
  /// Procedure:
  /// 1. Client calls UnaryCall with `SimpleRequest`:
  ///     {
  ///       response_compressed: {
  ///         value: true
  ///       }
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///     }
  ///     {
  ///       response_compressed: {
  ///         value: false
  ///       }
  ///       response_size: 314159
  ///       payload:  {
  ///         body: 271828 bytes of zeros
  ///       }
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * if supported by the implementation, when `response_compressed` is true,
  ///   the response MUST have the compressed message flag set.
  /// * if supported by the implementation, when `response_compressed` is false,
  ///   the response MUST NOT have the compressed message flag set.
  /// * response payload body is 314159 bytes in size in both cases.
  /// * clients are free to assert that the response payload body contents are
  ///   zero and comparing the entire response message against a golden response
  Future<void> serverCompressedUnary() async {
    throw 'Not implemented';
  }

  /// This test verifies that client-only streaming succeeds.
  ///
  /// Procedure:
  /// 1. Client calls StreamingInputCall
  /// 2. Client sends:
  ///     {
  ///       payload: {
  ///         body: 27182 bytes of zeros
  ///       }
  ///     }
  /// 3. Client then sends:
  ///     {
  ///       payload: {
  ///         body: 8 bytes of zeros
  ///       }
  ///     }
  /// 4. Client then sends:
  ///     {
  ///       payload: {
  ///         body: 1828 bytes of zeros
  ///       }
  ///     }
  /// 5. Client then sends:
  ///     {
  ///       payload: {
  ///         body: 45904 bytes of zeros
  ///       }
  ///     }
  /// 6. Client half-closes
  ///
  /// Client asserts:
  /// * call was successful
  /// * response aggregated_payload_size is 74922
  Future<void> clientStreaming() async {
    StreamingInputCallRequest createRequest(int bytes) {
      final request = StreamingInputCallRequest()..payload = Payload();
      request.payload.body = Uint8List(bytes);
      return request;
    }

    Stream<StreamingInputCallRequest> requests() async* {
      yield createRequest(27182);
      yield createRequest(8);
      yield createRequest(1828);
      yield createRequest(45904);
    }

    final response = await client.streamingInputCall(requests());
    if (response.aggregatedPayloadSize != 74922) {
      throw 'Response mismatch. Expected 74922, '
          'got ${response.aggregatedPayloadSize}';
    }
  }

  /// This test verifies the client can compress requests on per-message basis
  /// by performing a two-request streaming call. It also sends an initial
  /// probing request to verify whether the server supports the
  /// CompressedRequest feature by checking if the probing call fails with an
  /// `INVALID_ARGUMENT` status.
  ///
  /// Procedure:
  /// 1. Client calls `StreamingInputCall` and sends the following
  ///    feature-probing *uncompressed* `StreamingInputCallRequest` message
  ///     {
  ///       expect_compressed: {
  ///         value: true
  ///       }
  ///       payload:  {
  ///         body: 27182 bytes of zeros
  ///       }
  ///     }
  ///    If the call does not fail with `INVALID_ARGUMENT`, the test fails.
  ///    Otherwise, we continue.
  /// 1. Client calls `StreamingInputCall` again, sending the *compressed*
  ///    message
  ///     {
  ///       expect_compressed: {
  ///         value: true
  ///       }
  ///       payload: {
  ///         body: 27182 bytes of zeros
  ///       }
  ///     }
  /// 1. And finally, the *uncompressed* message
  ///     {
  ///       expect_compressed: {
  ///         value: false
  ///       }
  ///       payload:  {
  ///         body: 45904 bytes of zeros
  ///       }
  ///     }
  /// 1. Client half-closes
  ///
  /// Client asserts:
  /// * First call fails with `INVALID_ARGUMENT`.
  /// * Next calls succeeds.
  /// * Response aggregated payload size is 73086.
  Future<void> clientCompressedStreaming() async {
    throw 'Not implemented';
  }

  /// This test verifies that server-only streaming succeeds.
  ///
  /// Procedure:
  /// 1. Client calls StreamingOutputCall with `StreamingOutputCallRequest`:
  ///     {
  ///       response_parameters: {
  ///         size: 31415
  ///       }
  ///       response_parameters: {
  ///         size: 9
  ///       }
  ///       response_parameters: {
  ///         size: 2653
  ///       }
  ///       response_parameters: {
  ///         size: 58979
  ///       }
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * exactly four responses
  /// * response payload bodies are sized (in order): 31415, 9, 2653, 58979
  /// * clients are free to assert that the response payload body contents are
  ///   zero and comparing the entire response messages against golden responses
  Future<void> serverStreaming() async {
    final expectedResponses = [31415, 9, 2653, 58979];

    final request = StreamingOutputCallRequest()
      ..responseParameters.addAll(
          expectedResponses.map((size) => ResponseParameters()..size = size));

    final responses = await client.streamingOutputCall(request).toList();
    if (responses.length != 4) {
      throw 'Incorrect number of responses (${responses.length}).';
    }
    final responseLengths =
        responses.map((response) => response.payload.body.length).toList();

    if (!ListEquality().equals(responseLengths, expectedResponses)) {
      throw 'Incorrect response lengths received (${responseLengths.join(', ')} != ${expectedResponses.join(', ')})';
    }
  }

  /// This test verifies that the server can compress streaming messages and
  /// disable compression on individual messages, expecting the server's
  /// response to be compressed or not according to the `response_compressed`
  /// boolean.
  ///
  /// Whether compression was actually performed is determined by the
  /// compression bit in the response's message flags. *Note that some languages
  /// may not have access to the message flags, in which case the client will be
  /// unable to verify that the `response_compressed` boolean is obeyed by the
  /// server*.
  ///
  /// Procedure:
  /// 1. Client calls StreamingOutputCall with `StreamingOutputCallRequest`:
  ///     {
  ///       response_parameters: {
  ///         compressed: {
  ///           value: true
  ///         }
  ///         size: 31415
  ///       }
  ///       response_parameters: {
  ///         compressed: {
  ///           value: false
  ///         }
  ///         size: 92653
  ///       }
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * exactly two responses
  /// * if supported by the implementation, when `response_compressed` is false,
  ///   the response's messages MUST NOT have the compressed message flag set.
  /// * if supported by the implementation, when `response_compressed` is true,
  ///   the response's messages MUST have the compressed message flag set.
  /// * response payload bodies are sized (in order): 31415, 92653
  /// * clients are free to assert that the response payload body contents are
  ///   zero and comparing the entire response messages against golden responses
  Future<void> serverCompressedStreaming() async {
    throw 'Not implemented';
  }

  /// This test verifies that full duplex bidi is supported.
  ///
  /// Procedure:
  /// 1. Client calls FullDuplexCall with:
  ///     {
  ///       response_parameters: {
  ///         size: 31415
  ///       }
  ///       payload: {
  ///         body: 27182 bytes of zeros
  ///       }
  ///     }
  /// 2. After getting a reply, it sends:
  ///     {
  ///       response_parameters: {
  ///         size: 9
  ///       }
  ///       payload: {
  ///         body: 8 bytes of zeros
  ///       }
  ///     }
  /// 3. After getting a reply, it sends:
  ///     {
  ///       response_parameters: {
  ///         size: 2653
  ///       }
  ///       payload: {
  ///         body: 1828 bytes of zeros
  ///       }
  ///     }
  /// 4. After getting a reply, it sends:
  ///     {
  ///       response_parameters: {
  ///         size: 58979
  ///       }
  ///       payload: {
  ///         body: 45904 bytes of zeros
  ///       }
  ///     }
  /// 5. After getting a reply, client half-closes
  ///
  /// Client asserts:
  /// * call was successful
  /// * exactly four responses
  /// * response payload bodies are sized (in order): 31415, 9, 2653, 58979
  /// * clients are free to assert that the response payload body contents are
  ///   zero and comparing the entire response messages against golden responses
  Future<void> pingPong() async {
    final requestSizes = [27182, 8, 1828, 45904];
    final expectedResponses = [31415, 9, 2653, 58979];

    StreamingOutputCallRequest createRequest(int index) {
      final payload = Payload()..body = Uint8List(requestSizes[index]);
      final request = StreamingOutputCallRequest()
        ..payload = payload
        ..responseParameters
            .add(ResponseParameters()..size = expectedResponses[index]);
      return request;
    }

    var index = 0;
    final requests = StreamController<int>();

    final responses = client.fullDuplexCall(requests.stream.map(createRequest));
    requests.add(index);
    await for (final response in responses) {
      if (index >= expectedResponses.length) {
        throw 'Received too many responses. $index > ${expectedResponses.length}.';
      }
      if (response.payload.body.length != expectedResponses[index]) {
        throw 'Response mismatch for response $index: '
            '${response.payload.body.length} != ${expectedResponses[index]}.';
      }
      index++;
      if (index == requestSizes.length) {
        requests.close();
      } else {
        requests.add(index);
      }
    }
  }

  /// This test verifies that streams support having zero-messages in both
  /// directions.
  ///
  /// Procedure:
  /// 1. Client calls FullDuplexCall and then half-closes
  ///
  /// Client asserts:
  /// * call was successful
  /// * exactly zero responses
  Future<void> emptyStream() async {
    final requests = StreamController<StreamingOutputCallRequest>();
    final call = client.fullDuplexCall(requests.stream);
    requests.close();
    final responses = await call.toList();
    if (responses.isNotEmpty) {
      throw 'Received too many responses. ${responses.length} != 0';
    }
  }

  /// This test is only for cloud-to-prod path.
  ///
  /// This test verifies unary calls succeed in sending messages while using
  /// Service Credentials from GCE metadata server. The client instance needs to
  /// be created with desired oauth scope.
  ///
  /// The test uses `--default_service_account` with GCE service account email
  /// and `--oauth_scope` with the OAuth scope to use. For testing against
  /// grpc-test.sandbox.googleapis.com,
  /// "https://www.googleapis.com/auth/xapi.zoo" should be passed in as
  /// `--oauth_scope`.
  ///
  /// Procedure:
  /// 1. Client configures channel to use GCECredentials
  /// 2. Client calls UnaryCall on the channel with:
  ///     {
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///       fill_username: true
  ///       fill_oauth_scope: true
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * received SimpleResponse.username equals the value of
  ///   `--default_service_account` flag
  /// * received SimpleResponse.oauth_scope is in `--oauth_scope`
  /// * response payload body is 314159 bytes in size
  /// * clients are free to assert that the response payload body contents are
  ///   zero and comparing the entire response message against a golden response
  Future<void> computeEngineCreds() async {
    final credentials = ComputeEngineAuthenticator();
    final clientWithCredentials =
        TestServiceClient(channel, options: credentials.toCallOptions);

    final response = await _sendSimpleRequestForAuth(clientWithCredentials,
        fillUsername: true, fillOauthScope: true);

    final user = response.username;
    final oauth = response.oauthScope;

    if (user.isEmpty) {
      throw 'Username not received.';
    }
    if (oauth.isEmpty) {
      throw 'OAuth scope not received.';
    }

    if (user != defaultServiceAccount) {
      throw 'Got user name $user, wanted $defaultServiceAccount';
    }
    if (!oauthScope!.contains(oauth)) {
      throw 'Got OAuth scope $oauth, which is not a substring of $oauthScope';
    }
  }

  /// This test is only for cloud-to-prod path.
  ///
  /// This test verifies unary calls succeed in sending messages while using
  /// service account credentials.
  ///
  /// Test caller should set flag `--service_account_key_file` with the path to
  /// json key file downloaded from https://console.developers.google.com.
  /// Alternately, if using a usable auth implementation, she may specify the
  /// file location in the environment variable GOOGLE_APPLICATION_CREDENTIALS.
  ///
  /// Procedure:
  /// 1. Client configures the channel to use ServiceAccountCredentials
  /// 2. Client calls UnaryCall with:
  ///     {
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///       fill_username: true
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * received SimpleResponse.username is not empty and is in the json key
  ///   file used by the auth library. The client can optionally check the
  ///   username matches the email address in the key file or equals the value
  ///   of `--default_service_account` flag.
  /// * response payload body is 314159 bytes in size
  /// * clients are free to assert that the response payload body contents are
  ///   zero and comparing the entire response message against a golden response
  Future<void> serviceAccountCreds() async {
    throw 'Not implemented';
  }

  /// This test is only for cloud-to-prod path.
  ///
  /// This test verifies unary calls succeed in sending messages while using JWT
  /// token (created by the project's key file)
  ///
  /// Test caller should set flag `--service_account_key_file` with the path to
  /// json key file downloaded from https://console.developers.google.com.
  /// Alternately, if using a usable auth implementation, she may specify the
  /// file location in the environment variable GOOGLE_APPLICATION_CREDENTIALS.
  ///
  /// Procedure:
  /// 1. Client configures the channel to use JWTTokenCredentials
  /// 2. Client calls UnaryCall with:
  ///     {
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///       fill_username: true
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * received SimpleResponse.username is not empty and is in the json key
  ///   file used by the auth library. The client can optionally check the
  ///   username matches the email address in the key file or equals the value
  ///   of `--default_service_account` flag.
  /// * response payload body is 314159 bytes in size
  /// * clients are free to assert that the response payload body contents are
  ///   zero and comparing the entire response message against a golden response
  Future<void> jwtTokenCreds() async {
    final credentials = JwtServiceAccountAuthenticator(serviceAccountJson);
    final clientWithCredentials =
        TestServiceClient(channel, options: credentials.toCallOptions);

    final response = await _sendSimpleRequestForAuth(clientWithCredentials,
        fillUsername: true);
    final username = response.username;
    if (username.isEmpty) {
      throw 'Username not received.';
    }
    if (!serviceAccountJson.contains(username)) {
      throw 'Got user name $username, which is not a substring of $serviceAccountJson';
    }
  }

  /// This test is only for cloud-to-prod path and some implementations may run
  /// in GCE only.
  ///
  /// This test verifies unary calls succeed in sending messages using an OAuth2
  /// token that is obtained out of band. For the purpose of the test, the
  /// OAuth2 token is actually obtained from a service account credentials or
  /// GCE credentials via the language-specific authorization library.
  ///
  /// The difference between this test and the other auth tests is that it first
  /// uses the authorization library to obtain an authorization token.
  ///
  /// The test
  /// * uses the flag `--service_account_key_file` with the path to a json key
  ///   file downloaded from https://console.developers.google.com. Alternately,
  ///   if using a usable auth implementation, it may specify the file location
  ///   in the environment variable GOOGLE_APPLICATION_CREDENTIALS, *OR* if GCE
  ///   credentials is used to fetch the token, `--default_service_account` can
  ///   be used to pass in GCE service account email.
  /// * uses the flag `--oauth_scope` for the oauth scope. For testing against
  ///   grpc-test.sandbox.googleapis.com,
  ///   "https://www.googleapis.com/auth/xapi.zoo" should be passed as the
  ///   `--oauth_scope`.
  ///
  /// Procedure:
  /// 1. Client uses the auth library to obtain an authorization token
  /// 2. Client configures the channel to use AccessTokenCredentials with the
  ///    access token obtained in step 1
  /// 3. Client calls UnaryCall with the following message
  ///     {
  ///       fill_username: true
  ///       fill_oauth_scope: true
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * received SimpleResponse.username is valid. Depending on whether a
  ///   service account key file or GCE credentials was used, client should
  ///   check against the json key file or GCE default service account email.
  /// * received SimpleResponse.oauth_scope is in `--oauth_scope`
  Future<void> oauth2AuthToken() async {
    final credentials =
        ServiceAccountAuthenticator(serviceAccountJson, [oauthScope!]);
    final clientWithCredentials =
        TestServiceClient(channel, options: credentials.toCallOptions);

    final response = await _sendSimpleRequestForAuth(clientWithCredentials,
        fillUsername: true, fillOauthScope: true);

    final user = response.username;
    final oauth = response.oauthScope;

    if (user.isEmpty) {
      throw 'Username not received.';
    }
    if (oauth.isEmpty) {
      throw 'OAuth scope not received.';
    }

    if (!serviceAccountJson.contains(user)) {
      throw 'Got user name $user, which is not'
          ' a substring of $serviceAccountJson';
    }
    if (!oauthScope!.contains(oauth)) {
      throw 'Got OAuth scope $oauth, which is not a substring of $oauthScope';
    }
  }

  /// Similar to the other auth tests, this test is only for cloud-to-prod path.
  ///
  /// This test verifies unary calls succeed in sending messages using a JWT or
  /// a service account credentials set on the RPC.
  ///
  /// The test
  /// * uses the flag `--service_account_key_file` with the path to a json key
  ///   file downloaded from https://console.developers.google.com. Alternately,
  ///   if using a usable auth implementation, it may specify the file location
  ///   in the environment variable GOOGLE_APPLICATION_CREDENTIALS
  /// * optionally uses the flag `--oauth_scope` for the oauth scope if
  ///   implementor wishes to use service account credential instead of JWT
  ///   credential. For testing against grpc-test.sandbox.googleapis.com, oauth
  ///   scope "https://www.googleapis.com/auth/xapi.zoo" should be used.
  ///
  /// Procedure:
  /// 1. Client configures the channel with just SSL credentials
  /// 2. Client calls UnaryCall, setting per-call credentials to
  ///    JWTTokenCredentials. The request is the following message
  ///     {
  ///       fill_username: true
  ///     }
  ///
  /// Client asserts:
  /// * call was successful
  /// * received SimpleResponse.username is not empty and is in the json key
  ///   file used by the auth library. The client can optionally check the
  ///   username matches the email address in the key file.
  Future<void> perRpcCreds() async {
    final credentials =
        ServiceAccountAuthenticator(serviceAccountJson, [oauthScope!]);

    final response = await _sendSimpleRequestForAuth(client,
        fillUsername: true,
        fillOauthScope: true,
        options: credentials.toCallOptions);

    final user = response.username;
    final oauth = response.oauthScope;

    if (user.isEmpty) {
      throw 'Username not received.';
    }
    if (oauth.isEmpty) {
      throw 'OAuth scope not received.';
    }

    if (!serviceAccountJson.contains(user)) {
      throw 'Got user name $user, which is not a substring of $serviceAccountJson';
    }
    if (!oauthScope!.contains(oauth)) {
      throw 'Got OAuth scope $oauth, which is not a substring of $oauthScope';
    }
  }

  Future<SimpleResponse> _sendSimpleRequestForAuth(TestServiceClient client,
      {bool fillUsername = false,
      bool fillOauthScope = false,
      CallOptions? options}) async {
    final payload = Payload()..body = Uint8List(271828);
    final request = SimpleRequest()
      ..responseSize = 314159
      ..payload = payload
      ..fillUsername = fillUsername
      ..fillOauthScope = fillOauthScope;
    final response = await client.unaryCall(request, options: options);
    final receivedBytes = response.payload.body.length;
    if (receivedBytes != 314159) {
      throw 'Response payload mismatch. Expected 314159 bytes, '
          'got ${receivedBytes}.';
    }
    return response;
  }

  /// This test verifies that custom metadata in either binary or ascii format
  /// can be sent as initial-metadata by the client and as both initial- and
  /// trailing-metadata by the server.
  ///
  /// Procedure:
  /// 1. The client attaches custom metadata with the following keys and values:
  ///     key: "x-grpc-test-echo-initial", value: "test_initial_metadata_value"
  ///     key: "x-grpc-test-echo-trailing-bin", value: 0xababab
  ///    to a UnaryCall with request:
  ///     {
  ///       response_size: 314159
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///     }
  ///
  /// 2. The client attaches custom metadata with the following keys and values:
  ///     key: "x-grpc-test-echo-initial", value: "test_initial_metadata_value"
  ///     key: "x-grpc-test-echo-trailing-bin", value: 0xababab
  ///    to a FullDuplexCall with request:
  ///     {
  ///       response_parameters: {
  ///         size: 314159
  ///       }
  ///       payload: {
  ///         body: 271828 bytes of zeros
  ///       }
  ///     }
  ///    and then half-closes
  ///
  /// Client asserts:
  /// * call was successful
  /// * metadata with key `"x-grpc-test-echo-initial"` and value
  ///   `"test_initial_metadata_value"`is received in the initial metadata for
  ///   calls in Procedure steps 1 and 2.
  /// * metadata with key `"x-grpc-test-echo-trailing-bin"` and value `0xababab`
  ///   is received in the trailing metadata for calls in Procedure steps 1 and
  ///   2.
  Future<void> customMetadata() async {
    void validate(Map<String, String> headers, Map<String, String> trailers) {
      if (headers[_headerEchoKey] != _headerEchoData) {
        throw 'Invalid header data received.';
      }
      if (trailers[_trailerEchoKey] != _trailerEchoData) {
        throw 'Invalid trailer data received.';
      }
    }

    final options = CallOptions(metadata: {
      _headerEchoKey: _headerEchoData,
      _trailerEchoKey: _trailerEchoData,
    });
    final unaryCall = client.unaryCall(
        SimpleRequest()
          ..responseSize = 314159
          ..payload = (Payload()..body = Uint8List(271828)),
        options: options);
    var headers = await unaryCall.headers;
    var trailers = await unaryCall.trailers;
    await unaryCall;
    validate(headers, trailers);

    Stream<StreamingOutputCallRequest> requests() async* {
      yield StreamingOutputCallRequest()
        ..responseParameters.add(ResponseParameters()..size = 314159)
        ..payload = (Payload()..body = Uint8List(271828));
    }

    final fullDuplexCall = client.fullDuplexCall(requests(), options: options);
    final drain = fullDuplexCall.drain();
    headers = await fullDuplexCall.headers;
    trailers = await fullDuplexCall.trailers;
    await drain;
    validate(headers, trailers);
  }

  /// This test verifies unary calls succeed in sending messages, and propagate
  /// back status code and message sent along with the messages.
  ///
  /// Procedure:
  /// 1. Client calls UnaryCall with:
  ///     {
  ///       response_status: {
  ///         code: 2
  ///         message: "test status message"
  ///       }
  ///     }
  ///
  /// 2. Client calls FullDuplexCall with:
  ///     {
  ///       response_status: {
  ///         code: 2
  ///         message: "test status message"
  ///       }
  ///     }
  ///
  /// and then half-closes
  ///
  /// Client asserts:
  /// * received status code is the same as the sent code for both Procedure
  ///   steps 1 and 2
  /// * received status message is the same as the sent message for both
  ///   Procedure steps 1 and 2
  Future<void> statusCodeAndMessage() async {
    final expectedStatus = GrpcError.custom(2, 'test status message');
    final responseStatus = EchoStatus()
      ..code = expectedStatus.code
      ..message = expectedStatus.message!;
    try {
      await client.unaryCall(SimpleRequest()..responseStatus = responseStatus);
      throw 'Did not receive correct status code.';
    } on GrpcError catch (e) {
      if (e != expectedStatus) {
        throw 'Received incorrect status: $e.';
      }
    }
    Stream<StreamingOutputCallRequest> requests() async* {
      yield StreamingOutputCallRequest()..responseStatus = responseStatus;
    }

    try {
      await for (final _ in client.fullDuplexCall(requests())) {
        throw 'Received unexpected response.';
      }
      throw 'Did not receive correct status code.';
    } on GrpcError catch (e) {
      if (e != expectedStatus) {
        throw 'Received incorrect status: $e.';
      }
    }
  }

  /// This test verifies that calling an unimplemented RPC method returns the
  /// UNIMPLEMENTED status code.
  ///
  /// Procedure:
  /// * Client calls `grpc.testing.TestService/UnimplementedCall` with an empty
  ///   request (defined as `grpc.testing.Empty`):
  ///     {
  ///     }
  ///
  /// Client asserts:
  /// * received status code is 12 (UNIMPLEMENTED)
  Future<void> unimplementedMethod() async {
    try {
      await client.unimplementedCall(Empty());
      throw 'Did not throw.';
    } on GrpcError catch (e) {
      if (e.code != StatusCode.unimplemented) {
        throw 'Unexpected status code ${e.code} - ${e.message}.';
      }
    }
  }

  /// This test verifies calling an unimplemented server returns the
  /// UNIMPLEMENTED status code.
  ///
  /// Procedure:
  /// * Client calls `grpc.testing.UnimplementedService/UnimplementedCall` with
  ///   an empty request (defined as `grpc.testing.Empty`)
  ///
  /// Client asserts:
  /// * received status code is 12 (UNIMPLEMENTED)
  Future<void> unimplementedService() async {
    try {
      await unimplementedServiceClient.unimplementedCall(Empty());
      throw 'Did not throw.';
    } on GrpcError catch (e) {
      if (e.code != StatusCode.unimplemented) {
        throw 'Unexpected status code ${e.code} - ${e.message}.';
      }
    }
  }

  /// This test verifies that a request can be cancelled after metadata has been
  /// sent but before payloads are sent.
  ///
  /// Procedure:
  /// 1. Client starts StreamingInputCall
  /// 2. Client immediately cancels request
  ///
  /// Client asserts:
  /// * Call completed with status CANCELLED
  Future<void> cancelAfterBegin() async {
    final requests = StreamController<StreamingInputCallRequest>();
    final call = client.streamingInputCall(requests.stream);
    scheduleMicrotask(call.cancel);
    try {
      await call;
      throw 'Expected exception.';
    } on GrpcError catch (e) {
      if (e.code != StatusCode.cancelled) {
        throw 'Unexpected status code ${e.code} - ${e.message}';
      }
    }
    requests.close();
  }

  /// This test verifies that a request can be cancelled after receiving a
  /// message from the server.
  ///
  /// Procedure:
  /// 1. Client starts FullDuplexCall with
  ///     {
  ///       response_parameters: {
  ///         size: 31415
  ///       }
  ///       payload: {
  ///         body: 27182 bytes of zeros
  ///       }
  ///     }
  ///
  /// 2. After receiving a response, client cancels request
  ///
  /// Client asserts:
  /// * Call completed with status CANCELLED
  Future<void> cancelAfterFirstResponse() async {
    final requests = StreamController<StreamingOutputCallRequest>();
    final call = client.fullDuplexCall(requests.stream);
    final completer = Completer();

    var receivedResponse = false;
    call.listen((response) {
      if (receivedResponse) {
        completer.completeError('Received too many responses.');
        return;
      }
      receivedResponse = true;
      if (response.payload.body.length != 31415) {
        completer.completeError('Invalid response length: '
            '${response.payload.body.length} != 31415.');
      }
      call.cancel();
    }, onError: (e) {
      if (e is! GrpcError) {
        completer.completeError('Unexpected error: $e.');
      } else if (e.code != StatusCode.cancelled) {
        completer
            .completeError('Unexpected status code ${e.code}: ${e.message}.');
      } else {
        completer.complete(true);
      }
    }, onDone: () {
      if (!completer.isCompleted) completer.completeError('Expected error.');
    });

    requests.add(StreamingOutputCallRequest()
      ..responseParameters.add(ResponseParameters()..size = 31415)
      ..payload = (Payload()..body = Uint8List(27182)));
    await completer.future;
    requests.close();
  }

  /// This test verifies that an RPC request whose lifetime exceeds its
  /// configured timeout value will end with the DeadlineExceeded status.
  ///
  /// Procedure:
  /// 1. Client calls FullDuplexCall with the following request and sets its
  ///    timeout to 1ms
  ///     {
  ///       payload: {
  ///         body: 27182 bytes of zeros
  ///       }
  ///     }
  ///
  /// 2. Client waits
  ///
  /// Client asserts:
  /// * Call completed with status DEADLINE_EXCEEDED.
  Future<void> timeoutOnSleepingServer() async {
    final requests = StreamController<StreamingOutputCallRequest>();
    final call = client.fullDuplexCall(requests.stream,
        options: CallOptions(timeout: Duration(milliseconds: 1)));
    requests.add(StreamingOutputCallRequest()
      ..payload = (Payload()..body = Uint8List(27182)));
    try {
      await for (final _ in call) {
        throw 'Unexpected response received.';
      }
      throw 'Expected exception.';
    } on GrpcError catch (e) {
      if (e.code != StatusCode.deadlineExceeded) {
        throw 'Unexpected status code ${e.code} - ${e.message}.';
      }
    } finally {
      requests.close();
    }
  }
}


<|start_filename|>example/helloworld/bin/client.dart<|end_filename|>
// Copyright (c) 2018, the gRPC project authors. Please see the AUTHORS file
// for details. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// Dart implementation of the gRPC helloworld.Greeter client.
import 'package:grpc/grpc.dart';
import 'package:helloworld/src/generated/helloworld.pbgrpc.dart';

Future<void> main(List<String> args) async {
  final channel = ClientChannel(
    'localhost',
    port: 50051,
    options: ChannelOptions(
      credentials: ChannelCredentials.insecure(),
      codecRegistry:
          CodecRegistry(codecs: const [GzipCodec(), IdentityCodec()]),
    ),
  );
  final stub = GreeterClient(channel);

  final name = args.isNotEmpty ? args[0] : 'world';

  try {
    final response = await stub.sayHello(
      HelloRequest()..name = name,
      options: CallOptions(compression: const GzipCodec()),
    );
    print('Greeter client received: ${response.message}');
  } catch (e) {
    print('Caught error: $e');
  }
  await channel.shutdown();
}


<|start_filename|>test/client_tests/grpc_or_grpcweb_channel_grpc_test.dart<|end_filename|>
// Copyright (c) 2021, the gRPC project authors. Please see the AUTHORS file
// for details. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
@TestOn('!browser')
import 'package:grpc/grpc.dart';
import 'package:grpc/grpc_or_grpcweb.dart';
import 'package:test/test.dart';

const host = 'example.com';
const port = 8080;

void main() {
  test('Channel on non-web uses gRPC ClientChannel with correct params', () {
    final channel = GrpcOrGrpcWebClientChannel.toSingleEndpoint(
      host: host,
      port: port,
      transportSecure: false,
    );
    expect(channel.host, equals(host));
    expect(channel.port, equals(port));
    expect(channel.options.credentials.isSecure, isFalse);
  });

  test('Constructor grpc on non-web passes params correctly', () {
    final options = ChannelOptions(credentials: ChannelCredentials.insecure());
    final channel = GrpcOrGrpcWebClientChannel.grpc(
      host,
      port: port,
      options: options,
    );
    expect(channel.host, equals(host));
    expect(channel.port, equals(port));
    expect(channel.options, same(options));
  });
}


<|start_filename|>example/helloworld/lib/src/generated/helloworld.pbjson.dart<|end_filename|>
///
//  Generated code. Do not modify.
//  source: helloworld.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package

import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;

@$core.Deprecated('Use helloRequestDescriptor instead')
const HelloRequest$json = const {
  '1': 'HelloRequest',
  '2': const [
    const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'},
  ],
};

/// Descriptor for `HelloRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List helloRequestDescriptor =
    $convert.base64Decode('CgxIZWxsb1JlcXVlc3QSEgoEbmFtZRgBIAEoCVIEbmFtZQ==');
@$core.Deprecated('Use helloReplyDescriptor instead')
const HelloReply$json = const {
  '1': 'HelloReply',
  '2': const [
    const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
  ],
};

/// Descriptor for `HelloReply`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List helloReplyDescriptor = $convert
    .base64Decode('CgpIZWxsb1JlcGx5EhgKB21lc3NhZ2UYASABKAlSB21lc3NhZ2U=');


<|start_filename|>example/googleapis/lib/src/generated/google/logging/v2/logging.pbgrpc.dart<|end_filename|>
///
//  Generated code. Do not modify.
//  source: google/logging/v2/logging.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields

import 'dart:async' as $async;

import 'dart:core' as $core;

import 'package:grpc/service_api.dart' as $grpc;
import 'logging.pb.dart' as $2;
import '../../protobuf/empty.pb.dart' as $1;
export 'logging.pb.dart';

class LoggingServiceV2Client extends $grpc.Client {
  static final _$deleteLog = $grpc.ClientMethod<$2.DeleteLogRequest, $1.Empty>(
      '/google.logging.v2.LoggingServiceV2/DeleteLog',
      ($2.DeleteLogRequest value) => value.writeToBuffer(),
      ($core.List<$core.int> value) => $1.Empty.fromBuffer(value));
  static final _$writeLogEntries =
      $grpc.ClientMethod<$2.WriteLogEntriesRequest, $2.WriteLogEntriesResponse>(
          '/google.logging.v2.LoggingServiceV2/WriteLogEntries',
          ($2.WriteLogEntriesRequest value) => value.writeToBuffer(),
          ($core.List<$core.int> value) =>
              $2.WriteLogEntriesResponse.fromBuffer(value));
  static final _$listLogEntries =
      $grpc.ClientMethod<$2.ListLogEntriesRequest, $2.ListLogEntriesResponse>(
          '/google.logging.v2.LoggingServiceV2/ListLogEntries',
          ($2.ListLogEntriesRequest value) => value.writeToBuffer(),
          ($core.List<$core.int> value) =>
              $2.ListLogEntriesResponse.fromBuffer(value));
  static final _$listMonitoredResourceDescriptors = $grpc.ClientMethod<
          $2.ListMonitoredResourceDescriptorsRequest,
          $2.ListMonitoredResourceDescriptorsResponse>(
      '/google.logging.v2.LoggingServiceV2/ListMonitoredResourceDescriptors',
      ($2.ListMonitoredResourceDescriptorsRequest value) =>
          value.writeToBuffer(),
      ($core.List<$core.int> value) =>
          $2.ListMonitoredResourceDescriptorsResponse.fromBuffer(value));
  static final _$listLogs =
      $grpc.ClientMethod<$2.ListLogsRequest, $2.ListLogsResponse>(
          '/google.logging.v2.LoggingServiceV2/ListLogs',
          ($2.ListLogsRequest value) => value.writeToBuffer(),
          ($core.List<$core.int> value) =>
              $2.ListLogsResponse.fromBuffer(value));
  static final _$tailLogEntries =
      $grpc.ClientMethod<$2.TailLogEntriesRequest, $2.TailLogEntriesResponse>(
          '/google.logging.v2.LoggingServiceV2/TailLogEntries',
          ($2.TailLogEntriesRequest value) => value.writeToBuffer(),
          ($core.List<$core.int> value) =>
              $2.TailLogEntriesResponse.fromBuffer(value));

  LoggingServiceV2Client($grpc.ClientChannel channel,
      {$grpc.CallOptions? options,
      $core.Iterable<$grpc.ClientInterceptor>? interceptors})
      : super(channel, options: options, interceptors: interceptors);

  $grpc.ResponseFuture<$1.Empty> deleteLog($2.DeleteLogRequest request,
      {$grpc.CallOptions? options}) {
    return $createUnaryCall(_$deleteLog, request, options: options);
  }

  $grpc.ResponseFuture<$2.WriteLogEntriesResponse> writeLogEntries(
      $2.WriteLogEntriesRequest request,
      {$grpc.CallOptions? options}) {
    return $createUnaryCall(_$writeLogEntries, request, options: options);
  }

  $grpc.ResponseFuture<$2.ListLogEntriesResponse> listLogEntries(
      $2.ListLogEntriesRequest request,
      {$grpc.CallOptions? options}) {
    return $createUnaryCall(_$listLogEntries, request, options: options);
  }

  $grpc.ResponseFuture<$2.ListMonitoredResourceDescriptorsResponse>
      listMonitoredResourceDescriptors(
          $2.ListMonitoredResourceDescriptorsRequest request,
          {$grpc.CallOptions? options}) {
    return $createUnaryCall(_$listMonitoredResourceDescriptors, request,
        options: options);
  }

  $grpc.ResponseFuture<$2.ListLogsResponse> listLogs($2.ListLogsRequest request,
      {$grpc.CallOptions? options}) {
    return $createUnaryCall(_$listLogs, request, options: options);
  }

  $grpc.ResponseStream<$2.TailLogEntriesResponse> tailLogEntries(
      $async.Stream<$2.TailLogEntriesRequest> request,
      {$grpc.CallOptions? options}) {
    return $createStreamingCall(_$tailLogEntries, request, options: options);
  }
}

abstract class LoggingServiceV2ServiceBase extends $grpc.Service {
  $core.String get $name => 'google.logging.v2.LoggingServiceV2';

  LoggingServiceV2ServiceBase() {
    $addMethod($grpc.ServiceMethod<$2.DeleteLogRequest, $1.Empty>(
        'DeleteLog',
        deleteLog_Pre,
        false,
        false,
        ($core.List<$core.int> value) => $2.DeleteLogRequest.fromBuffer(value),
        ($1.Empty value) => value.writeToBuffer()));
    $addMethod($grpc.ServiceMethod<$2.WriteLogEntriesRequest,
            $2.WriteLogEntriesResponse>(
        'WriteLogEntries',
        writeLogEntries_Pre,
        false,
        false,
        ($core.List<$core.int> value) =>
            $2.WriteLogEntriesRequest.fromBuffer(value),
        ($2.WriteLogEntriesResponse value) => value.writeToBuffer()));
    $addMethod($grpc.ServiceMethod<$2.ListLogEntriesRequest,
            $2.ListLogEntriesResponse>(
        'ListLogEntries',
        listLogEntries_Pre,
        false,
        false,
        ($core.List<$core.int> value) =>
            $2.ListLogEntriesRequest.fromBuffer(value),
        ($2.ListLogEntriesResponse value) => value.writeToBuffer()));
    $addMethod($grpc.ServiceMethod<$2.ListMonitoredResourceDescriptorsRequest,
            $2.ListMonitoredResourceDescriptorsResponse>(
        'ListMonitoredResourceDescriptors',
        listMonitoredResourceDescriptors_Pre,
        false,
        false,
        ($core.List<$core.int> value) =>
            $2.ListMonitoredResourceDescriptorsRequest.fromBuffer(value),
        ($2.ListMonitoredResourceDescriptorsResponse value) =>
            value.writeToBuffer()));
    $addMethod($grpc.ServiceMethod<$2.ListLogsRequest, $2.ListLogsResponse>(
        'ListLogs',
        listLogs_Pre,
        false,
        false,
        ($core.List<$core.int> value) => $2.ListLogsRequest.fromBuffer(value),
        ($2.ListLogsResponse value) => value.writeToBuffer()));
    $addMethod($grpc.ServiceMethod<$2.TailLogEntriesRequest,
            $2.TailLogEntriesResponse>(
        'TailLogEntries',
        tailLogEntries,
        true,
        true,
        ($core.List<$core.int> value) =>
            $2.TailLogEntriesRequest.fromBuffer(value),
        ($2.TailLogEntriesResponse value) => value.writeToBuffer()));
  }

  $async.Future<$1.Empty> deleteLog_Pre($grpc.ServiceCall call,
      $async.Future<$2.DeleteLogRequest> request) async {
    return deleteLog(call, await request);
  }

  $async.Future<$2.WriteLogEntriesResponse> writeLogEntries_Pre(
      $grpc.ServiceCall call,
      $async.Future<$2.WriteLogEntriesRequest> request) async {
    return writeLogEntries(call, await request);
  }

  $async.Future<$2.ListLogEntriesResponse> listLogEntries_Pre(
      $grpc.ServiceCall call,
      $async.Future<$2.ListLogEntriesRequest> request) async {
    return listLogEntries(call, await request);
  }

  $async.Future<$2.ListMonitoredResourceDescriptorsResponse>
      listMonitoredResourceDescriptors_Pre(
          $grpc.ServiceCall call,
          $async.Future<$2.ListMonitoredResourceDescriptorsRequest>
              request) async {
    return listMonitoredResourceDescriptors(call, await request);
  }

  $async.Future<$2.ListLogsResponse> listLogs_Pre(
      $grpc.ServiceCall call, $async.Future<$2.ListLogsRequest> request) async {
    return listLogs(call, await request);
  }

  $async.Future<$1.Empty> deleteLog(
      $grpc.ServiceCall call, $2.DeleteLogRequest request);
  $async.Future<$2.WriteLogEntriesResponse> writeLogEntries(
      $grpc.ServiceCall call, $2.WriteLogEntriesRequest request);
  $async.Future<$2.ListLogEntriesResponse> listLogEntries(
      $grpc.ServiceCall call, $2.ListLogEntriesRequest request);
  $async.Future<$2.ListMonitoredResourceDescriptorsResponse>
      listMonitoredResourceDescriptors($grpc.ServiceCall call,
          $2.ListMonitoredResourceDescriptorsRequest request);
  $async.Future<$2.ListLogsResponse> listLogs(
      $grpc.ServiceCall call, $2.ListLogsRequest request);
  $async.Stream<$2.TailLogEntriesResponse> tailLogEntries(
      $grpc.ServiceCall call, $async.Stream<$2.TailLogEntriesRequest> request);
}


<|start_filename|>example/grpc-web/lib/src/generated/echo.pbjson.dart<|end_filename|>
///
//  Generated code. Do not modify.
//  source: echo.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package

import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;

@$core.Deprecated('Use echoRequestDescriptor instead')
const EchoRequest$json = const {
  '1': 'EchoRequest',
  '2': const [
    const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
  ],
};

/// Descriptor for `EchoRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List echoRequestDescriptor = $convert
    .base64Decode('CgtFY2hvUmVxdWVzdBIYCgdtZXNzYWdlGAEgASgJUgdtZXNzYWdl');
@$core.Deprecated('Use echoResponseDescriptor instead')
const EchoResponse$json = const {
  '1': 'EchoResponse',
  '2': const [
    const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
  ],
};

/// Descriptor for `EchoResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List echoResponseDescriptor = $convert
    .base64Decode('CgxFY2hvUmVzcG9uc2USGAoHbWVzc2FnZRgBIAEoCVIHbWVzc2FnZQ==');
@$core.Deprecated('Use serverStreamingEchoRequestDescriptor instead')
const ServerStreamingEchoRequest$json = const {
  '1': 'ServerStreamingEchoRequest',
  '2': const [
    const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
    const {'1': 'message_count', '3': 2, '4': 1, '5': 5, '10': 'messageCount'},
    const {
      '1': 'message_interval',
      '3': 3,
      '4': 1,
      '5': 5,
      '10': 'messageInterval'
    },
  ],
};

/// Descriptor for `ServerStreamingEchoRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List serverStreamingEchoRequestDescriptor =
    $convert.base64Decode(
        '<KEY>');
@$core.Deprecated('Use serverStreamingEchoResponseDescriptor instead')
const ServerStreamingEchoResponse$json = const {
  '1': 'ServerStreamingEchoResponse',
  '2': const [
    const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
  ],
};

/// Descriptor for `ServerStreamingEchoResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List serverStreamingEchoResponseDescriptor =
    $convert.base64Decode(
        '<KEY>');


<|start_filename|>example/metadata/lib/src/generated/metadata.pbjson.dart<|end_filename|>
///
//  Generated code. Do not modify.
//  source: metadata.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package

import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;

@$core.Deprecated('Use recordDescriptor instead')
const Record$json = const {
  '1': 'Record',
  '2': const [
    const {'1': 'value', '3': 1, '4': 1, '5': 9, '10': 'value'},
  ],
};

/// Descriptor for `Record`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List recordDescriptor =
    $convert.base64Decode('CgZSZWNvcmQSFAoFdmFsdWUYASABKAlSBXZhbHVl');
@$core.Deprecated('Use numberDescriptor instead')
const Number$json = const {
  '1': 'Number',
  '2': const [
    const {'1': 'value', '3': 1, '4': 1, '5': 5, '10': 'value'},
  ],
};

/// Descriptor for `Number`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List numberDescriptor =
    $convert.base64Decode('CgZOdW1iZXISFAoFdmFsdWUYASABKAVSBXZhbHVl');
@$core.Deprecated('Use emptyDescriptor instead')
const Empty$json = const {
  '1': 'Empty',
};

/// Descriptor for `Empty`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List emptyDescriptor =
    $convert.base64Decode('CgVFbXB0eQ==');


<|start_filename|>example/googleapis/lib/src/generated/google/protobuf/struct.pbjson.dart<|end_filename|>
///
//  Generated code. Do not modify.
//  source: google/protobuf/struct.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package

import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;

@$core.Deprecated('Use nullValueDescriptor instead')
const NullValue$json = const {
  '1': 'NullValue',
  '2': const [
    const {'1': 'NULL_VALUE', '2': 0},
  ],
};

/// Descriptor for `NullValue`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List nullValueDescriptor =
    $convert.base64Decode('CglOdWxsVmFsdWUSDgoKTlVMTF9WQUxVRRAA');
@$core.Deprecated('Use structDescriptor instead')
const Struct$json = const {
  '1': 'Struct',
  '2': const [
    const {
      '1': 'fields',
      '3': 1,
      '4': 3,
      '5': 11,
      '6': '.google.protobuf.Struct.FieldsEntry',
      '10': 'fields'
    },
  ],
  '3': const [Struct_FieldsEntry$json],
};

@$core.Deprecated('Use structDescriptor instead')
const Struct_FieldsEntry$json = const {
  '1': 'FieldsEntry',
  '2': const [
    const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
    const {
      '1': 'value',
      '3': 2,
      '4': 1,
      '5': 11,
      '6': '.google.protobuf.Value',
      '10': 'value'
    },
  ],
  '7': const {'7': true},
};

/// Descriptor for `Struct`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List structDescriptor = $convert.base64Decode(
    '<KEY>');
@$core.Deprecated('Use valueDescriptor instead')
const Value$json = const {
  '1': 'Value',
  '2': const [
    const {
      '1': 'null_value',
      '3': 1,
      '4': 1,
      '5': 14,
      '6': '.google.protobuf.NullValue',
      '9': 0,
      '10': 'nullValue'
    },
    const {
      '1': 'number_value',
      '3': 2,
      '4': 1,
      '5': 1,
      '9': 0,
      '10': 'numberValue'
    },
    const {
      '1': 'string_value',
      '3': 3,
      '4': 1,
      '5': 9,
      '9': 0,
      '10': 'stringValue'
    },
    const {
      '1': 'bool_value',
      '3': 4,
      '4': 1,
      '5': 8,
      '9': 0,
      '10': 'boolValue'
    },
    const {
      '1': 'struct_value',
      '3': 5,
      '4': 1,
      '5': 11,
      '6': '.google.protobuf.Struct',
      '9': 0,
      '10': 'structValue'
    },
    const {
      '1': 'list_value',
      '3': 6,
      '4': 1,
      '5': 11,
      '6': '.google.protobuf.ListValue',
      '9': 0,
      '10': 'listValue'
    },
  ],
  '8': const [
    const {'1': 'kind'},
  ],
};

/// Descriptor for `Value`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List valueDescriptor = $convert.base64Decode(
    '<KEY>');
@$core.Deprecated('Use listValueDescriptor instead')
const ListValue$json = const {
  '1': 'ListValue',
  '2': const [
    const {
      '1': 'values',
      '3': 1,
      '4': 3,
      '5': 11,
      '6': '.google.protobuf.Value',
      '10': 'values'
    },
  ],
};

/// Descriptor for `ListValue`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List listValueDescriptor = $convert.base64Decode(
    'C<KEY>');


<|start_filename|>example/googleapis/lib/src/generated/google/api/label.pb.dart<|end_filename|>
///
//  Generated code. Do not modify.
//  source: google/api/label.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields

import 'dart:core' as $core;

import 'package:protobuf/protobuf.dart' as $pb;

import 'label.pbenum.dart';

export 'label.pbenum.dart';

class LabelDescriptor extends $pb.GeneratedMessage {
  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      const $core.bool.fromEnvironment('protobuf.omit_message_names')
          ? ''
          : 'LabelDescriptor',
      package: const $pb.PackageName(
          const $core.bool.fromEnvironment('protobuf.omit_message_names')
              ? ''
              : 'google.api'),
      createEmptyInstance: create)
    ..aOS(
        1,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'key')
    ..e<LabelDescriptor_ValueType>(
        2,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'valueType',
        $pb.PbFieldType.OE,
        defaultOrMaker: LabelDescriptor_ValueType.STRING,
        valueOf: LabelDescriptor_ValueType.valueOf,
        enumValues: LabelDescriptor_ValueType.values)
    ..aOS(
        3,
        const $core.bool.fromEnvironment('protobuf.omit_field_names')
            ? ''
            : 'description')
    ..hasRequiredFields = false;

  LabelDescriptor._() : super();
  factory LabelDescriptor({
    $core.String? key,
    LabelDescriptor_ValueType? valueType,
    $core.String? description,
  }) {
    final _result = create();
    if (key != null) {
      _result.key = key;
    }
    if (valueType != null) {
      _result.valueType = valueType;
    }
    if (description != null) {
      _result.description = description;
    }
    return _result;
  }
  factory LabelDescriptor.fromBuffer($core.List<$core.int> i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(i, r);
  factory LabelDescriptor.fromJson($core.String i,
          [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(i, r);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
      'Will be removed in next major version')
  LabelDescriptor clone() => LabelDescriptor()..mergeFromMessage(this);
  @$core.Deprecated('Using this can add significant overhead to your binary. '
      'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
      'Will be removed in next major version')
  LabelDescriptor copyWith(void Function(LabelDescriptor) updates) =>
      super.copyWith((message) => updates(message as LabelDescriptor))
          as LabelDescriptor; // ignore: deprecated_member_use
  $pb.BuilderInfo get info_ => _i;
  @$core.pragma('dart2js:noInline')
  static LabelDescriptor create() => LabelDescriptor._();
  LabelDescriptor createEmptyInstance() => create();
  static $pb.PbList<LabelDescriptor> createRepeated() =>
      $pb.PbList<LabelDescriptor>();
  @$core.pragma('dart2js:noInline')
  static LabelDescriptor getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<LabelDescriptor>(create);
  static LabelDescriptor? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get key => $_getSZ(0);
  @$pb.TagNumber(1)
  set key($core.String v) {
    $_setString(0, v);
  }

  @$pb.TagNumber(1)
  $core.bool hasKey() => $_has(0);
  @$pb.TagNumber(1)
  void clearKey() => clearField(1);

  @$pb.TagNumber(2)
  LabelDescriptor_ValueType get valueType => $_getN(1);
  @$pb.TagNumber(2)
  set valueType(LabelDescriptor_ValueType v) {
    setField(2, v);
  }

  @$pb.TagNumber(2)
  $core.bool hasValueType() => $_has(1);
  @$pb.TagNumber(2)
  void clearValueType() => clearField(2);

  @$pb.TagNumber(3)
  $core.String get description => $_getSZ(2);
  @$pb.TagNumber(3)
  set description($core.String v) {
    $_setString(2, v);
  }

  @$pb.TagNumber(3)
  $core.bool hasDescription() => $_has(2);
  @$pb.TagNumber(3)
  void clearDescription() => clearField(3);
}


<|start_filename|>example/googleapis/lib/src/generated/google/protobuf/duration.pbjson.dart<|end_filename|>
///
//  Generated code. Do not modify.
//  source: google/protobuf/duration.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package

import 'dart:core' as $core;
import 'dart:convert' as $convert;
import 'dart:typed_data' as $typed_data;

@$core.Deprecated('Use durationDescriptor instead')
const Duration$json = const {
  '1': 'Duration',
  '2': const [
    const {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'},
    const {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'},
  ],
};

/// Descriptor for `Duration`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List durationDescriptor = $convert.base64Decode(
    'CghEdXJhdGlvbhIYCgdzZWNvbmRzGAEgASgDUgdzZWNvbmRzEhQKBW5hbm9zGAIgASgFUgVuYW5vcw==');
