Skip to content

Commit

Permalink
Regenerated pigeons.
Browse files Browse the repository at this point in the history
  • Loading branch information
diegotori committed Dec 21, 2024
1 parent cc89613 commit 6f51bca
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 56 deletions.
28 changes: 11 additions & 17 deletions wakelock_plus_platform_interface/lib/messages.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ PlatformException _createConnectionError(String channelName) {
);
}

List<Object?> wrapResponse(
{Object? result, PlatformException? error, bool empty = false}) {
List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) {
if (empty) {
return <Object?>[];
}
Expand Down Expand Up @@ -70,14 +69,15 @@ class IsEnabledMessage {
}
}


class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is ToggleMessage) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else if (value is IsEnabledMessage) {
} else if (value is IsEnabledMessage) {
buffer.putUint8(130);
writeValue(buffer, value.encode());
} else {
Expand All @@ -88,9 +88,9 @@ class _PigeonCodec extends StandardMessageCodec {
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 129:
case 129:
return ToggleMessage.decode(readValue(buffer)!);
case 130:
case 130:
return IsEnabledMessage.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
Expand All @@ -102,22 +102,18 @@ class WakelockPlusApi {
/// Constructor for [WakelockPlusApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
WakelockPlusApi(
{BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
WakelockPlusApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
: pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix =
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
final BinaryMessenger? pigeonVar_binaryMessenger;

static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();

final String pigeonVar_messageChannelSuffix;

Future<void> toggle(ToggleMessage msg) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
final String pigeonVar_channelName = 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
Expand All @@ -138,10 +134,8 @@ class WakelockPlusApi {
}

Future<IsEnabledMessage> isEnabled() async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
final String pigeonVar_channelName = 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
Expand Down
59 changes: 20 additions & 39 deletions wakelock_plus_platform_interface/test/messages.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import 'package:flutter_test/flutter_test.dart';

import 'package:wakelock_plus_platform_interface/messages.g.dart';


class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is ToggleMessage) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else if (value is IsEnabledMessage) {
} else if (value is IsEnabledMessage) {
buffer.putUint8(130);
writeValue(buffer, value.encode());
} else {
Expand All @@ -28,9 +29,9 @@ class _PigeonCodec extends StandardMessageCodec {
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 129:
case 129:
return ToggleMessage.decode(readValue(buffer)!);
case 130:
case 130:
return IsEnabledMessage.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
Expand All @@ -39,37 +40,25 @@ class _PigeonCodec extends StandardMessageCodec {
}

abstract class TestWakelockPlusApi {
static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
TestDefaultBinaryMessengerBinding.instance;
static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();

void toggle(ToggleMessage msg);

IsEnabledMessage isEnabled();

static void setUp(
TestWakelockPlusApi? api, {
BinaryMessenger? binaryMessenger,
String messageChannelSuffix = '',
}) {
messageChannelSuffix =
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
static void setUp(TestWakelockPlusApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) {
messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
{
final BasicMessageChannel<
Object?> pigeonVar_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$messageChannelSuffix',
pigeonChannelCodec,
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$messageChannelSuffix', pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
_testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
} else {
_testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(pigeonVar_channel,
(Object? message) async {
_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle was null.');
'Argument for dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle was null.');
final List<Object?> args = (message as List<Object?>?)!;
final ToggleMessage? arg_msg = (args[0] as ToggleMessage?);
assert(arg_msg != null,
Expand All @@ -79,35 +68,27 @@ abstract class TestWakelockPlusApi {
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<
Object?> pigeonVar_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$messageChannelSuffix',
pigeonChannelCodec,
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$messageChannelSuffix', pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
_testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
} else {
_testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(pigeonVar_channel,
(Object? message) async {
_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (Object? message) async {
try {
final IsEnabledMessage output = api.isEnabled();
return <Object?>[output];
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
}
});
}
Expand Down

0 comments on commit 6f51bca

Please sign in to comment.