From dad7bbcdae8c694453e5581e1ac02bd39f2cd1c1 Mon Sep 17 00:00:00 2001 From: Diego Tori Date: Thu, 17 Apr 2025 14:25:15 -0400 Subject: [PATCH 1/3] Added correct import header location in the iOS platform channel. --- wakelock_plus/ios/.gitignore | 1 + wakelock_plus/ios/wakelock_plus/Package.swift | 2 +- .../Sources/wakelock_plus/UIApplication+idleTimerLock.m | 2 +- .../Sources/wakelock_plus/WakelockPlusPlugin.m | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/wakelock_plus/ios/.gitignore b/wakelock_plus/ios/.gitignore index 0c88507..ee5dcb5 100644 --- a/wakelock_plus/ios/.gitignore +++ b/wakelock_plus/ios/.gitignore @@ -9,6 +9,7 @@ profile DerivedData/ build/ +.build/ GeneratedPluginRegistrant.h GeneratedPluginRegistrant.m diff --git a/wakelock_plus/ios/wakelock_plus/Package.swift b/wakelock_plus/ios/wakelock_plus/Package.swift index 790ec85..dd6db8b 100644 --- a/wakelock_plus/ios/wakelock_plus/Package.swift +++ b/wakelock_plus/ios/wakelock_plus/Package.swift @@ -17,7 +17,7 @@ let package = Package( name: "wakelock_plus", dependencies: [], resources: [ - .process("Resources") + .process("PrivacyInfo.xcprivacy"), ], cSettings: [ .headerSearchPath("include/wakelock_plus") diff --git a/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/UIApplication+idleTimerLock.m b/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/UIApplication+idleTimerLock.m index 1c3631f..9a3ba76 100644 --- a/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/UIApplication+idleTimerLock.m +++ b/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/UIApplication+idleTimerLock.m @@ -5,7 +5,7 @@ // Created by suyao on 2021/12/17. // -#import "UIApplication+idleTimerLock.h" +#import "./include/wakelock_plus/UIApplication+idleTimerLock.h" #import static NSString *idleTimerLockKey = @"idleTimerLockKey"; diff --git a/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/WakelockPlusPlugin.m b/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/WakelockPlusPlugin.m index c5857fe..a2ab44b 100644 --- a/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/WakelockPlusPlugin.m +++ b/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/WakelockPlusPlugin.m @@ -1,6 +1,6 @@ -#import "WakelockPlusPlugin.h" -#import "messages.g.h" -#import "UIApplication+idleTimerLock.h" +#import "./include/wakelock_plus/WakelockPlusPlugin.h" +#import "./include/wakelock_plus/messages.g.h" +#import "./include/wakelock_plus/UIApplication+idleTimerLock.h" @interface WakelockPlusPlugin () From 543f944f3925f78811e8824ee3fab3e241065df8 Mon Sep 17 00:00:00 2001 From: Diego Tori Date: Thu, 17 Apr 2025 15:03:05 -0400 Subject: [PATCH 2/3] upgraded win32 and dbus. --- wakelock_plus/example/ios/Podfile.lock | 8 ++++---- .../xcshareddata/xcschemes/Runner.xcscheme | 1 + wakelock_plus/ios/wakelock_plus.podspec | 2 +- wakelock_plus/pubspec.yaml | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/wakelock_plus/example/ios/Podfile.lock b/wakelock_plus/example/ios/Podfile.lock index 48fcbdb..2fd83ad 100644 --- a/wakelock_plus/example/ios/Podfile.lock +++ b/wakelock_plus/example/ios/Podfile.lock @@ -25,10 +25,10 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573 - package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4 - wakelock_plus: 373cfe59b235a6dd5837d0fb88791d2f13a90d56 + integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e + package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 + wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556 PODFILE CHECKSUM: beab77b38961de946f08660e554f80ac174dc842 -COCOAPODS: 1.16.1 +COCOAPODS: 1.16.2 diff --git a/wakelock_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/wakelock_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 3d0fb00..7bdc624 100644 --- a/wakelock_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/wakelock_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -59,6 +59,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" + enableGPUValidationMode = "1" allowLocationSimulation = "YES"> diff --git a/wakelock_plus/ios/wakelock_plus.podspec b/wakelock_plus/ios/wakelock_plus.podspec index ed17d5b..22b77bd 100644 --- a/wakelock_plus/ios/wakelock_plus.podspec +++ b/wakelock_plus/ios/wakelock_plus.podspec @@ -16,7 +16,7 @@ Plugin that allows you to keep the device screen awake, i.e. prevent the screen s.source_files = 'wakelock_plus/Sources/wakelock_plus/**/*.{h,m}' s.public_header_files = 'wakelock_plus/Sources/wakelock_plus/include/**/*.h' s.dependency 'Flutter' - s.platform = :ios, '11.0' + s.platform = :ios, '12.0' # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } diff --git a/wakelock_plus/pubspec.yaml b/wakelock_plus/pubspec.yaml index e79d7b5..ad9f582 100644 --- a/wakelock_plus/pubspec.yaml +++ b/wakelock_plus/pubspec.yaml @@ -19,10 +19,10 @@ dependencies: # Windows dependencies # win32 is compatible across v5 for Win32 only (not COM) - win32: ">=5.5.1 <6.0.0" + win32: ">=5.6.1 <6.0.0" # Linux dependencies - dbus: ^0.7.10 + dbus: ^0.7.11 package_info_plus: ">=6.0.0 <9.0.0" # Web dependencies From e29c0fcc755c0e9ef25837bb626123c780a9036a Mon Sep 17 00:00:00 2001 From: Diego Tori Date: Thu, 17 Apr 2025 15:03:34 -0400 Subject: [PATCH 3/3] Upgraded pigeon to version 25.3.0. --- .../plus/wakelock/WakelockPlusMessages.g.kt | 52 +++++++++- .../include/wakelock_plus/messages.g.h | 2 +- .../Sources/wakelock_plus/messages.g.m | 2 +- wakelock_plus/pubspec.yaml | 2 +- .../lib/messages.g.dart | 96 ++++++++++++++----- .../test/messages.g.dart | 63 +++++------- 6 files changed, 149 insertions(+), 68 deletions(-) diff --git a/wakelock_plus/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusMessages.g.kt b/wakelock_plus/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusMessages.g.kt index e6701b1..ca5d62a 100644 --- a/wakelock_plus/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusMessages.g.kt +++ b/wakelock_plus/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusMessages.g.kt @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") @@ -44,6 +44,36 @@ class WakelockPlusFlutterError ( override val message: String? = null, val details: Any? = null ) : Throwable() +private fun deepEqualsWakelockPlusMessages(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && + a.indices.all{ deepEqualsWakelockPlusMessages(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && + a.indices.all{ deepEqualsWakelockPlusMessages(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && a.all { + (b as Map).containsKey(it.key) && + deepEqualsWakelockPlusMessages(it.value, b[it.key]) + } + } + return a == b +} + /** * Message for toggling the wakelock on the platform side. @@ -65,6 +95,16 @@ data class ToggleMessage ( enable, ) } + override fun equals(other: Any?): Boolean { + if (other !is ToggleMessage) { + return false + } + if (this === other) { + return true + } + return deepEqualsWakelockPlusMessages(toList(), other.toList()) } + + override fun hashCode(): Int = toList().hashCode() } /** @@ -87,6 +127,16 @@ data class IsEnabledMessage ( enabled, ) } + override fun equals(other: Any?): Boolean { + if (other !is IsEnabledMessage) { + return false + } + if (this === other) { + return true + } + return deepEqualsWakelockPlusMessages(toList(), other.toList()) } + + override fun hashCode(): Int = toList().hashCode() } private open class WakelockPlusMessagesPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { diff --git a/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/include/wakelock_plus/messages.g.h b/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/include/wakelock_plus/messages.g.h index f73f840..c4220b2 100644 --- a/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/include/wakelock_plus/messages.g.h +++ b/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/include/wakelock_plus/messages.g.h @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import diff --git a/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/messages.g.m b/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/messages.g.m index 25110f4..e799845 100644 --- a/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/messages.g.m +++ b/wakelock_plus/ios/wakelock_plus/Sources/wakelock_plus/messages.g.m @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "./include/wakelock_plus/messages.g.h" diff --git a/wakelock_plus/pubspec.yaml b/wakelock_plus/pubspec.yaml index ad9f582..5191528 100644 --- a/wakelock_plus/pubspec.yaml +++ b/wakelock_plus/pubspec.yaml @@ -32,7 +32,7 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^5.0.0 - pigeon: ^22.7.0 # dart run pigeon --input "pigeons/messages.dart" + pigeon: ^25.3.0 # dart run pigeon --input "pigeons/messages.dart" # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/wakelock_plus_platform_interface/lib/messages.g.dart b/wakelock_plus_platform_interface/lib/messages.g.dart index fac93c4..5e00c0a 100644 --- a/wakelock_plus_platform_interface/lib/messages.g.dart +++ b/wakelock_plus_platform_interface/lib/messages.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -15,8 +15,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -25,6 +24,20 @@ List wrapResponse( } return [error.code, error.message, error.details]; } +bool _deepEquals(Object? a, Object? b) { + if (a is List && b is List) { + return a.length == b.length && + a.indexed + .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); + } + if (a is Map && b is Map) { + return a.length == b.length && a.entries.every((MapEntry entry) => + (b as Map).containsKey(entry.key) && + _deepEquals(entry.value, b[entry.key])); + } + return a == b; +} + /// Message for toggling the wakelock on the platform side. class ToggleMessage { @@ -34,18 +47,38 @@ class ToggleMessage { bool? enable; - Object encode() { + List _toList() { return [ enable, ]; } + Object encode() { + return _toList(); } + static ToggleMessage decode(Object result) { result as List; return ToggleMessage( enable: result[0] as bool?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! ToggleMessage || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()) +; } /// Message for reporting the wakelock state from the platform side. @@ -56,20 +89,41 @@ class IsEnabledMessage { bool? enabled; - Object encode() { + List _toList() { return [ enabled, ]; } + Object encode() { + return _toList(); } + static IsEnabledMessage decode(Object result) { result as List; return IsEnabledMessage( enabled: result[0] as bool?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! IsEnabledMessage || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()) +; } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -77,10 +131,10 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is ToggleMessage) { + } else 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 { @@ -91,9 +145,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); @@ -105,11 +159,9 @@ 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 pigeonChannelCodec = _PigeonCodec(); @@ -117,16 +169,15 @@ class WakelockPlusApi { final String pigeonVar_messageChannelSuffix; Future toggle(ToggleMessage msg) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([msg]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -141,16 +192,15 @@ class WakelockPlusApi { } Future isEnabled() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/wakelock_plus_platform_interface/test/messages.g.dart b/wakelock_plus_platform_interface/test/messages.g.dart index 3175f44..e863826 100644 --- a/wakelock_plus_platform_interface/test/messages.g.dart +++ b/wakelock_plus_platform_interface/test/messages.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import, no_leading_underscores_for_local_identifiers // ignore_for_file: avoid_relative_lib_imports @@ -10,6 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:wakelock_plus_platform_interface/messages.g.dart'; + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -17,10 +18,10 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is ToggleMessage) { + } else 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 { @@ -31,9 +32,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); @@ -42,37 +43,25 @@ class _PigeonCodec extends StandardMessageCodec { } abstract class TestWakelockPlusApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec 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 pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.toggle$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(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 args = (message as List?)!; final ToggleMessage? arg_msg = (args[0] as ToggleMessage?); assert(arg_msg != null, @@ -82,35 +71,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 pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.wakelock_plus_platform_interface.WakelockPlusApi.isEnabled$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(pigeonVar_channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(pigeonVar_channel, (Object? message) async { try { final IsEnabledMessage output = api.isEnabled(); return [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())); } }); }