setUp static method

void setUp(
  1. SentianceCrashDetectionListenerApi? api, {
  2. BinaryMessenger? binaryMessenger,
  3. String messageChannelSuffix = '',
})

Implementation

static void setUp(SentianceCrashDetectionListenerApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) {
  messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.sentiance_crash_detection.SentianceCrashDetectionListenerApi.onVehicleCrashEvent$messageChannelSuffix', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.sentiance_crash_detection.SentianceCrashDetectionListenerApi.onVehicleCrashEvent was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final CrashEvent? arg_event = (args[0] as CrashEvent?);
        assert(arg_event != null,
            'Argument for dev.flutter.pigeon.sentiance_crash_detection.SentianceCrashDetectionListenerApi.onVehicleCrashEvent was null, expected non-null CrashEvent.');
        try {
          api.onVehicleCrashEvent(arg_event!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.sentiance_crash_detection.SentianceCrashDetectionListenerApi.onVehicleCrashDiagnostic$messageChannelSuffix', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.sentiance_crash_detection.SentianceCrashDetectionListenerApi.onVehicleCrashDiagnostic was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final VehicleCrashDiagnostic? arg_diagnostic = (args[0] as VehicleCrashDiagnostic?);
        assert(arg_diagnostic != null,
            'Argument for dev.flutter.pigeon.sentiance_crash_detection.SentianceCrashDetectionListenerApi.onVehicleCrashDiagnostic was null, expected non-null VehicleCrashDiagnostic.');
        try {
          api.onVehicleCrashDiagnostic(arg_diagnostic!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
}