Skip to content

Commit

Permalink
Fixed dart formatting issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
diegotori committed Mar 26, 2024
1 parent 851f925 commit 426f820
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 26 deletions.
22 changes: 14 additions & 8 deletions wakelock_plus_platform_interface/lib/messages.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ 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 @@ -87,9 +88,9 @@ class _WakelockPlusApiCodec extends StandardMessageCodec {
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
case 128:
return IsEnabledMessage.decode(readValue(buffer)!);
case 129:
case 129:
return ToggleMessage.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
Expand All @@ -105,11 +106,14 @@ class WakelockPlusApi {
: __pigeon_binaryMessenger = binaryMessenger;
final BinaryMessenger? __pigeon_binaryMessenger;

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

Future<void> toggle(ToggleMessage msg) async {
const String __pigeon_channelName = 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle';
final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
const String __pigeon_channelName =
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle';
final BasicMessageChannel<Object?> __pigeon_channel =
BasicMessageChannel<Object?>(
__pigeon_channelName,
pigeonChannelCodec,
binaryMessenger: __pigeon_binaryMessenger,
Expand All @@ -130,8 +134,10 @@ class WakelockPlusApi {
}

Future<IsEnabledMessage> isEnabled() async {
const String __pigeon_channelName = 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled';
final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
const String __pigeon_channelName =
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled';
final BasicMessageChannel<Object?> __pigeon_channel =
BasicMessageChannel<Object?>(
__pigeon_channelName,
pigeonChannelCodec,
binaryMessenger: __pigeon_binaryMessenger,
Expand Down
51 changes: 33 additions & 18 deletions wakelock_plus_platform_interface/test/messages.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class _TestWakelockPlusApiCodec extends StandardMessageCodec {
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
case 128:
return IsEnabledMessage.decode(readValue(buffer)!);
case 129:
case 129:
return ToggleMessage.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
Expand All @@ -39,24 +39,32 @@ class _TestWakelockPlusApiCodec extends StandardMessageCodec {
}

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

void toggle(ToggleMessage msg);

IsEnabledMessage isEnabled();

static void setup(TestWakelockPlusApi? api, {BinaryMessenger? binaryMessenger}) {
static void setup(TestWakelockPlusApi? api,
{BinaryMessenger? binaryMessenger}) {
{
final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle', pigeonChannelCodec,
final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle',
pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, null);
_testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(__pigeon_channel, null);
} else {
_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, (Object? message) async {
_testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(__pigeon_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 @@ -66,27 +74,34 @@ 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?> __pigeon_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled', pigeonChannelCodec,
final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled',
pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, null);
_testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(__pigeon_channel, null);
} else {
_testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, (Object? message) async {
_testBinaryMessengerBinding!.defaultBinaryMessenger
.setMockDecodedMessageHandler<Object?>(__pigeon_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 426f820

Please sign in to comment.