creativecreatorormaybenot
Committed by GitHub

Upgrade packages to Flutter 2.5.0 (#137)

* Upgrade packages to Flutter 2.5.0

* Fix generated

* Fix import
1 -include: package:pedantic/analysis_options.yaml 1 +include: package:flutter_lints/flutter.yaml
2 2
3 linter: 3 linter:
4 rules: 4 rules:
  1 +## 0.5.4
  2 +
  3 +* Upgraded `pigeon` and lints.
  4 +
1 ## 0.5.3+3 5 ## 0.5.3+3
2 6
3 * Updated GitHub references to use `main` instead of `master`. 7 * Updated GitHub references to use `main` instead of `master`.
1 -// Autogenerated from Pigeon (v0.2.1), do not edit directly. 1 +// Autogenerated from Pigeon (v1.0.2), do not edit directly.
2 // See also: https://pub.dev/packages/pigeon 2 // See also: https://pub.dev/packages/pigeon
3 3
4 package creativemaybeno.wakelock; 4 package creativemaybeno.wakelock;
5 5
6 import io.flutter.plugin.common.BasicMessageChannel; 6 import io.flutter.plugin.common.BasicMessageChannel;
7 import io.flutter.plugin.common.BinaryMessenger; 7 import io.flutter.plugin.common.BinaryMessenger;
  8 +import io.flutter.plugin.common.MessageCodec;
8 import io.flutter.plugin.common.StandardMessageCodec; 9 import io.flutter.plugin.common.StandardMessageCodec;
  10 +import java.io.ByteArrayOutputStream;
  11 +import java.nio.ByteBuffer;
  12 +import java.util.Arrays;
  13 +import java.util.ArrayList;
9 import java.util.List; 14 import java.util.List;
10 import java.util.Map; 15 import java.util.Map;
11 import java.util.HashMap; 16 import java.util.HashMap;
@@ -51,24 +56,64 @@ public class Messages { @@ -51,24 +56,64 @@ public class Messages {
51 return fromMapResult; 56 return fromMapResult;
52 } 57 }
53 } 58 }
  59 + private static class WakelockApiCodec extends StandardMessageCodec {
  60 + public static final WakelockApiCodec INSTANCE = new WakelockApiCodec();
  61 + private WakelockApiCodec() {}
  62 + @Override
  63 + protected Object readValueOfType(byte type, ByteBuffer buffer) {
  64 + switch (type) {
  65 + case (byte)128:
  66 + return IsEnabledMessage.fromMap((Map<String, Object>) readValue(buffer));
  67 +
  68 + case (byte)129:
  69 + return ToggleMessage.fromMap((Map<String, Object>) readValue(buffer));
  70 +
  71 + default:
  72 + return super.readValueOfType(type, buffer);
  73 +
  74 + }
  75 + }
  76 + @Override
  77 + protected void writeValue(ByteArrayOutputStream stream, Object value) {
  78 + if (value instanceof IsEnabledMessage) {
  79 + stream.write(128);
  80 + writeValue(stream, ((IsEnabledMessage) value).toMap());
  81 + } else
  82 + if (value instanceof ToggleMessage) {
  83 + stream.write(129);
  84 + writeValue(stream, ((ToggleMessage) value).toMap());
  85 + } else
  86 +{
  87 + super.writeValue(stream, value);
  88 + }
  89 + }
  90 + }
54 91
55 /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/ 92 /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
56 public interface WakelockApi { 93 public interface WakelockApi {
57 - void toggle(ToggleMessage arg); 94 + void toggle(ToggleMessage msg);
58 IsEnabledMessage isEnabled(); 95 IsEnabledMessage isEnabled();
59 96
  97 + /** The codec used by WakelockApi. */
  98 + static MessageCodec<Object> getCodec() {
  99 + return WakelockApiCodec.INSTANCE;
  100 + }
  101 +
60 /** Sets up an instance of `WakelockApi` to handle messages through the `binaryMessenger`. */ 102 /** Sets up an instance of `WakelockApi` to handle messages through the `binaryMessenger`. */
61 static void setup(BinaryMessenger binaryMessenger, WakelockApi api) { 103 static void setup(BinaryMessenger binaryMessenger, WakelockApi api) {
62 { 104 {
63 BasicMessageChannel<Object> channel = 105 BasicMessageChannel<Object> channel =
64 - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WakelockApi.toggle", new StandardMessageCodec()); 106 + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WakelockApi.toggle", getCodec());
65 if (api != null) { 107 if (api != null) {
66 channel.setMessageHandler((message, reply) -> { 108 channel.setMessageHandler((message, reply) -> {
67 Map<String, Object> wrapped = new HashMap<>(); 109 Map<String, Object> wrapped = new HashMap<>();
68 try { 110 try {
69 - @SuppressWarnings("ConstantConditions")  
70 - ToggleMessage input = ToggleMessage.fromMap((Map<String, Object>)message);  
71 - api.toggle(input); 111 + ArrayList<Object> args = (ArrayList<Object>)message;
  112 + ToggleMessage msgArg = (ToggleMessage)args.get(0);
  113 + if (msgArg == null) {
  114 + throw new NullPointerException("msgArg unexpectedly null.");
  115 + }
  116 + api.toggle(msgArg);
72 wrapped.put("result", null); 117 wrapped.put("result", null);
73 } 118 }
74 catch (Error | RuntimeException exception) { 119 catch (Error | RuntimeException exception) {
@@ -82,13 +127,13 @@ public class Messages { @@ -82,13 +127,13 @@ public class Messages {
82 } 127 }
83 { 128 {
84 BasicMessageChannel<Object> channel = 129 BasicMessageChannel<Object> channel =
85 - new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WakelockApi.isEnabled", new StandardMessageCodec()); 130 + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WakelockApi.isEnabled", getCodec());
86 if (api != null) { 131 if (api != null) {
87 channel.setMessageHandler((message, reply) -> { 132 channel.setMessageHandler((message, reply) -> {
88 Map<String, Object> wrapped = new HashMap<>(); 133 Map<String, Object> wrapped = new HashMap<>();
89 try { 134 try {
90 IsEnabledMessage output = api.isEnabled(); 135 IsEnabledMessage output = api.isEnabled();
91 - wrapped.put("result", output.toMap()); 136 + wrapped.put("result", output);
92 } 137 }
93 catch (Error | RuntimeException exception) { 138 catch (Error | RuntimeException exception) {
94 wrapped.put("error", wrapError(exception)); 139 wrapped.put("error", wrapError(exception));
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
2 import 'package:wakelock/wakelock.dart'; 2 import 'package:wakelock/wakelock.dart';
3 3
4 void main() { 4 void main() {
5 - runApp(WakelockExampleApp()); 5 + runApp(const WakelockExampleApp());
6 } 6 }
7 7
8 /// Example app widget demonstrating how to use the wakelock plugin. 8 /// Example app widget demonstrating how to use the wakelock plugin.
@@ -10,6 +10,9 @@ void main() { @@ -10,6 +10,9 @@ void main() {
10 /// The example implementation is located inside [OutlinedButton.onPressed] 10 /// The example implementation is located inside [OutlinedButton.onPressed]
11 /// callback functions and a [FutureBuilder]. 11 /// callback functions and a [FutureBuilder].
12 class WakelockExampleApp extends StatefulWidget { 12 class WakelockExampleApp extends StatefulWidget {
  13 + /// Creates the [WakelockExampleApp] widget.
  14 + const WakelockExampleApp({Key key}) : super(key: key);
  15 +
13 @override 16 @override
14 _WakelockExampleAppState createState() => _WakelockExampleAppState(); 17 _WakelockExampleAppState createState() => _WakelockExampleAppState();
15 } 18 }
@@ -28,11 +28,10 @@ dev_dependencies: @@ -28,11 +28,10 @@ dev_dependencies:
28 sdk: flutter 28 sdk: flutter
29 flutter_driver: 29 flutter_driver:
30 sdk: flutter 30 sdk: flutter
  31 + integration_test:
  32 + sdk: flutter
31 33
32 - integration_test: ^1.0.1  
33 - test: any  
34 -  
35 - pedantic: ^1.11.0 34 + flutter_lints: ^1.0.4
36 35
37 dependency_overrides: 36 dependency_overrides:
38 # We override the platform dependencies of wakelock here because we use the example app for 37 # We override the platform dependencies of wakelock here because we use the example app for
@@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
2 // Generated file. Do not edit. 2 // Generated file. Do not edit.
3 // 3 //
4 4
  5 +// clang-format off
  6 +
5 #ifndef GENERATED_PLUGIN_REGISTRANT_ 7 #ifndef GENERATED_PLUGIN_REGISTRANT_
6 #define GENERATED_PLUGIN_REGISTRANT_ 8 #define GENERATED_PLUGIN_REGISTRANT_
7 9
1 -// Autogenerated from Pigeon (v0.2.1), do not edit directly. 1 +// Autogenerated from Pigeon (v1.0.2), do not edit directly.
2 // See also: https://pub.dev/packages/pigeon 2 // See also: https://pub.dev/packages/pigeon
3 #import <Foundation/Foundation.h> 3 #import <Foundation/Foundation.h>
4 @protocol FlutterBinaryMessenger; 4 @protocol FlutterBinaryMessenger;
  5 +@protocol FlutterMessageCodec;
5 @class FlutterError; 6 @class FlutterError;
6 @class FlutterStandardTypedData; 7 @class FlutterStandardTypedData;
7 8
@@ -18,11 +19,14 @@ NS_ASSUME_NONNULL_BEGIN @@ -18,11 +19,14 @@ NS_ASSUME_NONNULL_BEGIN
18 @property(nonatomic, strong, nullable) NSNumber * enabled; 19 @property(nonatomic, strong, nullable) NSNumber * enabled;
19 @end 20 @end
20 21
  22 +/// The codec used by FLTWakelockApi.
  23 +NSObject<FlutterMessageCodec> *FLTWakelockApiGetCodec(void);
  24 +
21 @protocol FLTWakelockApi 25 @protocol FLTWakelockApi
22 --(void)toggle:(FLTToggleMessage*)input error:(FlutterError *_Nullable *_Nonnull)error;  
23 --(nullable FLTIsEnabledMessage *)isEnabled:(FlutterError *_Nullable *_Nonnull)error; 26 +- (void)toggleMsg:(FLTToggleMessage *)msg error:(FlutterError *_Nullable *_Nonnull)error;
  27 +- (nullable FLTIsEnabledMessage *)isEnabledWithError:(FlutterError *_Nullable *_Nonnull)error;
24 @end 28 @end
25 29
26 -extern void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTWakelockApi> _Nullable api); 30 +extern void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTWakelockApi> *_Nullable api);
27 31
28 NS_ASSUME_NONNULL_END 32 NS_ASSUME_NONNULL_END
1 -// Autogenerated from Pigeon (v0.2.1), do not edit directly. 1 +// Autogenerated from Pigeon (v1.0.2), do not edit directly.
2 // See also: https://pub.dev/packages/pigeon 2 // See also: https://pub.dev/packages/pigeon
3 #import "messages.h" 3 #import "messages.h"
4 #import <Flutter/Flutter.h> 4 #import <Flutter/Flutter.h>
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 #error File requires ARC to be enabled. 7 #error File requires ARC to be enabled.
8 #endif 8 #endif
9 9
10 -static NSDictionary<NSString*, id>* wrapResult(NSDictionary *result, FlutterError *error) { 10 +static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error) {
11 NSDictionary *errorDict = (NSDictionary *)[NSNull null]; 11 NSDictionary *errorDict = (NSDictionary *)[NSNull null];
12 if (error) { 12 if (error) {
13 errorDict = @{ 13 errorDict = @{
@@ -23,53 +23,116 @@ static NSDictionary<NSString*, id>* wrapResult(NSDictionary *result, FlutterErro @@ -23,53 +23,116 @@ static NSDictionary<NSString*, id>* wrapResult(NSDictionary *result, FlutterErro
23 } 23 }
24 24
25 @interface FLTToggleMessage () 25 @interface FLTToggleMessage ()
26 -+(FLTToggleMessage*)fromMap:(NSDictionary*)dict;  
27 --(NSDictionary*)toMap; 26 ++ (FLTToggleMessage *)fromMap:(NSDictionary *)dict;
  27 +- (NSDictionary *)toMap;
28 @end 28 @end
29 @interface FLTIsEnabledMessage () 29 @interface FLTIsEnabledMessage ()
30 -+(FLTIsEnabledMessage*)fromMap:(NSDictionary*)dict;  
31 --(NSDictionary*)toMap; 30 ++ (FLTIsEnabledMessage *)fromMap:(NSDictionary *)dict;
  31 +- (NSDictionary *)toMap;
32 @end 32 @end
33 33
34 @implementation FLTToggleMessage 34 @implementation FLTToggleMessage
35 -+(FLTToggleMessage*)fromMap:(NSDictionary*)dict {  
36 - FLTToggleMessage* result = [[FLTToggleMessage alloc] init]; 35 ++ (FLTToggleMessage *)fromMap:(NSDictionary *)dict {
  36 + FLTToggleMessage *result = [[FLTToggleMessage alloc] init];
37 result.enable = dict[@"enable"]; 37 result.enable = dict[@"enable"];
38 if ((NSNull *)result.enable == [NSNull null]) { 38 if ((NSNull *)result.enable == [NSNull null]) {
39 result.enable = nil; 39 result.enable = nil;
40 } 40 }
41 return result; 41 return result;
42 } 42 }
43 --(NSDictionary*)toMap { 43 +- (NSDictionary *)toMap {
44 return [NSDictionary dictionaryWithObjectsAndKeys:(self.enable ? self.enable : [NSNull null]), @"enable", nil]; 44 return [NSDictionary dictionaryWithObjectsAndKeys:(self.enable ? self.enable : [NSNull null]), @"enable", nil];
45 } 45 }
46 @end 46 @end
47 47
48 @implementation FLTIsEnabledMessage 48 @implementation FLTIsEnabledMessage
49 -+(FLTIsEnabledMessage*)fromMap:(NSDictionary*)dict {  
50 - FLTIsEnabledMessage* result = [[FLTIsEnabledMessage alloc] init]; 49 ++ (FLTIsEnabledMessage *)fromMap:(NSDictionary *)dict {
  50 + FLTIsEnabledMessage *result = [[FLTIsEnabledMessage alloc] init];
51 result.enabled = dict[@"enabled"]; 51 result.enabled = dict[@"enabled"];
52 if ((NSNull *)result.enabled == [NSNull null]) { 52 if ((NSNull *)result.enabled == [NSNull null]) {
53 result.enabled = nil; 53 result.enabled = nil;
54 } 54 }
55 return result; 55 return result;
56 } 56 }
57 --(NSDictionary*)toMap { 57 +- (NSDictionary *)toMap {
58 return [NSDictionary dictionaryWithObjectsAndKeys:(self.enabled ? self.enabled : [NSNull null]), @"enabled", nil]; 58 return [NSDictionary dictionaryWithObjectsAndKeys:(self.enabled ? self.enabled : [NSNull null]), @"enabled", nil];
59 } 59 }
60 @end 60 @end
61 61
62 -void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTWakelockApi> api) { 62 +@interface FLTWakelockApiCodecReader : FlutterStandardReader
  63 +@end
  64 +@implementation FLTWakelockApiCodecReader
  65 +- (nullable id)readValueOfType:(UInt8)type
  66 +{
  67 + switch (type) {
  68 + case 128:
  69 + return [FLTIsEnabledMessage fromMap:[self readValue]];
  70 +
  71 + case 129:
  72 + return [FLTToggleMessage fromMap:[self readValue]];
  73 +
  74 + default:
  75 + return [super readValueOfType:type];
  76 +
  77 + }
  78 +}
  79 +@end
  80 +
  81 +@interface FLTWakelockApiCodecWriter : FlutterStandardWriter
  82 +@end
  83 +@implementation FLTWakelockApiCodecWriter
  84 +- (void)writeValue:(id)value
  85 +{
  86 + if ([value isKindOfClass:[FLTIsEnabledMessage class]]) {
  87 + [self writeByte:128];
  88 + [self writeValue:[value toMap]];
  89 + } else
  90 + if ([value isKindOfClass:[FLTToggleMessage class]]) {
  91 + [self writeByte:129];
  92 + [self writeValue:[value toMap]];
  93 + } else
  94 +{
  95 + [super writeValue:value];
  96 + }
  97 +}
  98 +@end
  99 +
  100 +@interface FLTWakelockApiCodecReaderWriter : FlutterStandardReaderWriter
  101 +@end
  102 +@implementation FLTWakelockApiCodecReaderWriter
  103 +- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data {
  104 + return [[FLTWakelockApiCodecWriter alloc] initWithData:data];
  105 +}
  106 +- (FlutterStandardReader *)readerWithData:(NSData *)data {
  107 + return [[FLTWakelockApiCodecReader alloc] initWithData:data];
  108 +}
  109 +@end
  110 +
  111 +NSObject<FlutterMessageCodec> *FLTWakelockApiGetCodec() {
  112 + static dispatch_once_t s_pred = 0;
  113 + static FlutterStandardMessageCodec *s_sharedObject = nil;
  114 + dispatch_once(&s_pred, ^{
  115 + FLTWakelockApiCodecReaderWriter *readerWriter = [[FLTWakelockApiCodecReaderWriter alloc] init];
  116 + s_sharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter];
  117 + });
  118 + return s_sharedObject;
  119 +}
  120 +
  121 +
  122 +void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTWakelockApi> *api) {
63 { 123 {
64 FlutterBasicMessageChannel *channel = 124 FlutterBasicMessageChannel *channel =
65 [FlutterBasicMessageChannel 125 [FlutterBasicMessageChannel
66 messageChannelWithName:@"dev.flutter.pigeon.WakelockApi.toggle" 126 messageChannelWithName:@"dev.flutter.pigeon.WakelockApi.toggle"
67 - binaryMessenger:binaryMessenger]; 127 + binaryMessenger:binaryMessenger
  128 + codec:FLTWakelockApiGetCodec()];
68 if (api) { 129 if (api) {
  130 + NSCAssert([api respondsToSelector:@selector(toggleMsg:error:)], @"FLTWakelockApi api doesn't respond to @selector(toggleMsg:error:)");
69 [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { 131 [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
70 - FLTToggleMessage *input = [FLTToggleMessage fromMap:message]; 132 + NSArray *args = message;
  133 + FLTToggleMessage *arg_msg = args[0];
71 FlutterError *error; 134 FlutterError *error;
72 - [api toggle:input error:&error]; 135 + [api toggleMsg:arg_msg error:&error];
73 callback(wrapResult(nil, error)); 136 callback(wrapResult(nil, error));
74 }]; 137 }];
75 } 138 }
@@ -81,12 +144,14 @@ void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTWakel @@ -81,12 +144,14 @@ void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTWakel
81 FlutterBasicMessageChannel *channel = 144 FlutterBasicMessageChannel *channel =
82 [FlutterBasicMessageChannel 145 [FlutterBasicMessageChannel
83 messageChannelWithName:@"dev.flutter.pigeon.WakelockApi.isEnabled" 146 messageChannelWithName:@"dev.flutter.pigeon.WakelockApi.isEnabled"
84 - binaryMessenger:binaryMessenger]; 147 + binaryMessenger:binaryMessenger
  148 + codec:FLTWakelockApiGetCodec()];
85 if (api) { 149 if (api) {
  150 + NSCAssert([api respondsToSelector:@selector(isEnabledWithError:)], @"FLTWakelockApi api doesn't respond to @selector(isEnabledWithError:)");
86 [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { 151 [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
87 FlutterError *error; 152 FlutterError *error;
88 - FLTIsEnabledMessage *output = [api isEnabled:&error];  
89 - callback(wrapResult([output toMap], error)); 153 + FLTIsEnabledMessage *output = [api isEnabledWithError:&error];
  154 + callback(wrapResult(output, error));
90 }]; 155 }];
91 } 156 }
92 else { 157 else {
1 -import 'package:pigeon/java_generator.dart';  
2 -import 'package:pigeon/objc_generator.dart';  
3 import 'package:pigeon/pigeon.dart'; 1 import 'package:pigeon/pigeon.dart';
4 2
5 /// Message for toggling the wakelock on the platform side. 3 /// Message for toggling the wakelock on the platform side.
@@ -12,22 +10,22 @@ class IsEnabledMessage { @@ -12,22 +10,22 @@ class IsEnabledMessage {
12 bool? enabled; 10 bool? enabled;
13 } 11 }
14 12
  13 +@ConfigurePigeon(PigeonOptions(
  14 + dartOut: '../wakelock_platform_interface/lib/messages.dart',
  15 + dartTestOut: '../wakelock_platform_interface/test/messages.dart',
  16 + objcHeaderOut: 'ios/Classes/messages.h',
  17 + objcSourceOut: 'ios/Classes/messages.m',
  18 + objcOptions: ObjcOptions(
  19 + prefix: 'FLT',
  20 + ),
  21 + javaOut: 'android/src/main/java/creativemaybeno/wakelock/Messages.java',
  22 + javaOptions: JavaOptions(
  23 + package: 'creativemaybeno.wakelock',
  24 + ),
  25 +))
15 @HostApi(dartHostTestHandler: 'TestWakelockApi') 26 @HostApi(dartHostTestHandler: 'TestWakelockApi')
16 abstract class WakelockApi { 27 abstract class WakelockApi {
17 void toggle(ToggleMessage msg); 28 void toggle(ToggleMessage msg);
18 29
19 IsEnabledMessage isEnabled(); 30 IsEnabledMessage isEnabled();
20 } 31 }
21 -  
22 -void configurePigeon(PigeonOptions options) {  
23 - options  
24 - ..dartOut = '../wakelock_platform_interface/lib/messages.dart'  
25 - ..dartTestOut = '../wakelock_platform_interface/test/messages.dart'  
26 - ..objcHeaderOut = 'ios/Classes/messages.h'  
27 - ..objcSourceOut = 'ios/Classes/messages.m'  
28 - ..objcOptions = ObjcOptions()  
29 - ..objcOptions?.prefix = 'FLT'  
30 - ..javaOut = 'android/src/main/java/creativemaybeno/wakelock/Messages.java'  
31 - ..javaOptions = JavaOptions()  
32 - ..javaOptions?.package = 'creativemaybeno.wakelock';  
33 -}  
@@ -2,7 +2,7 @@ name: wakelock @@ -2,7 +2,7 @@ name: wakelock
2 description: >-2 2 description: >-2
3 Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on 3 Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on
4 Android, iOS, macOS, Windows, and web. 4 Android, iOS, macOS, Windows, and web.
5 -version: 0.5.3+3 5 +version: 0.5.4
6 homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock 6 homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock
7 7
8 environment: 8 environment:
@@ -24,8 +24,8 @@ dev_dependencies: @@ -24,8 +24,8 @@ dev_dependencies:
24 flutter_test: 24 flutter_test:
25 sdk: flutter 25 sdk: flutter
26 26
27 - pedantic: ^1.11.0  
28 - pigeon: ^0.2.1 # flutter pub run pigeon --input "pigeons/messages.dart" 27 + flutter_lints: ^1.0.4
  28 + pigeon: ^1.0.2 # flutter pub run pigeon --input "pigeons/messages.dart"
29 29
30 flutter: 30 flutter:
31 plugin: 31 plugin:
  1 +## 0.1.0+3
  2 +
  3 +* Upgraded lints.
  4 +
1 ## 0.1.0+2 5 ## 0.1.0+2
2 6
3 * Updated GitHub references to use `main` instead of `master`. 7 * Updated GitHub references to use `main` instead of `master`.
1 name: wakelock_macos 1 name: wakelock_macos
2 description: >-2 2 description: >-2
3 macOS platform implementation of the wakelock_platform_interface for the wakelock plugin. 3 macOS platform implementation of the wakelock_platform_interface for the wakelock plugin.
4 -version: 0.1.0+2 4 +version: 0.1.0+3
5 homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock_macos 5 homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock_macos
6 6
7 environment: 7 environment:
@@ -20,7 +20,7 @@ dev_dependencies: @@ -20,7 +20,7 @@ dev_dependencies:
20 flutter_test: 20 flutter_test:
21 sdk: flutter 21 sdk: flutter
22 22
23 - pedantic: ^1.11.0 23 + flutter_lints: ^1.0.4
24 24
25 flutter: 25 flutter:
26 plugin: 26 plugin:
@@ -12,7 +12,7 @@ void main() { @@ -12,7 +12,7 @@ void main() {
12 // Consequently, the macOS implementation will be tested in CI via the 12 // Consequently, the macOS implementation will be tested in CI via the
13 // example integration test running on -d macos. 13 // example integration test running on -d macos.
14 test('stub', () { 14 test('stub', () {
15 - final acceptUnitTestingDefeat = true; 15 + const acceptUnitTestingDefeat = true;
16 expect(acceptUnitTestingDefeat, isTrue); 16 expect(acceptUnitTestingDefeat, isTrue);
17 }); 17 });
18 } 18 }
  1 +## 0.2.1+3
  2 +
  3 +* Upgraded lints.
  4 +
1 ## 0.2.1+2 5 ## 0.2.1+2
2 6
3 * Updated GitHub references to use `main` instead of `master`. 7 * Updated GitHub references to use `main` instead of `master`.
1 -// Autogenerated from Pigeon (v0.2.1), do not edit directly. 1 +// Autogenerated from Pigeon (v1.0.2), do not edit directly.
2 // See also: https://pub.dev/packages/pigeon 2 // See also: https://pub.dev/packages/pigeon
3 -// 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 3 +// 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
4 // @dart = 2.12 4 // @dart = 2.12
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; 6 import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
7 7
  8 +import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
8 import 'package:flutter/services.dart'; 9 import 'package:flutter/services.dart';
9 10
10 class ToggleMessage { 11 class ToggleMessage {
@@ -37,6 +38,36 @@ class IsEnabledMessage { @@ -37,6 +38,36 @@ class IsEnabledMessage {
37 } 38 }
38 } 39 }
39 40
  41 +class _WakelockApiCodec extends StandardMessageCodec {
  42 + const _WakelockApiCodec();
  43 + @override
  44 + void writeValue(WriteBuffer buffer, Object? value) {
  45 + if (value is IsEnabledMessage) {
  46 + buffer.putUint8(128);
  47 + writeValue(buffer, value.encode());
  48 + } else if (value is ToggleMessage) {
  49 + buffer.putUint8(129);
  50 + writeValue(buffer, value.encode());
  51 + } else {
  52 + super.writeValue(buffer, value);
  53 + }
  54 + }
  55 +
  56 + @override
  57 + Object? readValueOfType(int type, ReadBuffer buffer) {
  58 + switch (type) {
  59 + case 128:
  60 + return IsEnabledMessage.decode(readValue(buffer)!);
  61 +
  62 + case 129:
  63 + return ToggleMessage.decode(readValue(buffer)!);
  64 +
  65 + default:
  66 + return super.readValueOfType(type, buffer);
  67 + }
  68 + }
  69 +}
  70 +
40 class WakelockApi { 71 class WakelockApi {
41 /// Constructor for [WakelockApi]. The [binaryMessenger] named argument is 72 /// Constructor for [WakelockApi]. The [binaryMessenger] named argument is
42 /// available for dependency injection. If it is left null, the default 73 /// available for dependency injection. If it is left null, the default
@@ -46,13 +77,14 @@ class WakelockApi { @@ -46,13 +77,14 @@ class WakelockApi {
46 77
47 final BinaryMessenger? _binaryMessenger; 78 final BinaryMessenger? _binaryMessenger;
48 79
49 - Future<void> toggle(ToggleMessage arg) async {  
50 - final Object encoded = arg.encode(); 80 + static const MessageCodec<Object?> codec = _WakelockApiCodec();
  81 +
  82 + Future<void> toggle(ToggleMessage arg_msg) async {
51 final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( 83 final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
52 - 'dev.flutter.pigeon.WakelockApi.toggle', const StandardMessageCodec(), 84 + 'dev.flutter.pigeon.WakelockApi.toggle', codec,
53 binaryMessenger: _binaryMessenger); 85 binaryMessenger: _binaryMessenger);
54 final Map<Object?, Object?>? replyMap = 86 final Map<Object?, Object?>? replyMap =
55 - await channel.send(encoded) as Map<Object?, Object?>?; 87 + await channel.send(<Object>[arg_msg]) as Map<Object?, Object?>?;
56 if (replyMap == null) { 88 if (replyMap == null) {
57 throw PlatformException( 89 throw PlatformException(
58 code: 'channel-error', 90 code: 'channel-error',
@@ -68,14 +100,13 @@ class WakelockApi { @@ -68,14 +100,13 @@ class WakelockApi {
68 details: error['details'], 100 details: error['details'],
69 ); 101 );
70 } else { 102 } else {
71 - // noop 103 + return;
72 } 104 }
73 } 105 }
74 106
75 Future<IsEnabledMessage> isEnabled() async { 107 Future<IsEnabledMessage> isEnabled() async {
76 final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( 108 final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
77 - 'dev.flutter.pigeon.WakelockApi.isEnabled',  
78 - const StandardMessageCodec(), 109 + 'dev.flutter.pigeon.WakelockApi.isEnabled', codec,
79 binaryMessenger: _binaryMessenger); 110 binaryMessenger: _binaryMessenger);
80 final Map<Object?, Object?>? replyMap = 111 final Map<Object?, Object?>? replyMap =
81 await channel.send(null) as Map<Object?, Object?>?; 112 await channel.send(null) as Map<Object?, Object?>?;
@@ -94,7 +125,7 @@ class WakelockApi { @@ -94,7 +125,7 @@ class WakelockApi {
94 details: error['details'], 125 details: error['details'],
95 ); 126 );
96 } else { 127 } else {
97 - return IsEnabledMessage.decode(replyMap['result']!); 128 + return (replyMap['result'] as IsEnabledMessage?)!;
98 } 129 }
99 } 130 }
100 } 131 }
@@ -2,7 +2,7 @@ name: wakelock_platform_interface @@ -2,7 +2,7 @@ name: wakelock_platform_interface
2 description: >-2 2 description: >-2
3 A common platform interface for the wakelock plugin used by the different platform 3 A common platform interface for the wakelock plugin used by the different platform
4 implementations. 4 implementations.
5 -version: 0.2.1+2 5 +version: 0.2.1+3
6 homepage: >-2 6 homepage: >-2
7 https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock_platform_interface 7 https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock_platform_interface
8 8
@@ -19,4 +19,4 @@ dev_dependencies: @@ -19,4 +19,4 @@ dev_dependencies:
19 flutter_test: 19 flutter_test:
20 sdk: flutter 20 sdk: flutter
21 21
22 - pedantic: ^1.11.0 22 + flutter_lints: ^1.0.4
1 -// Autogenerated from Pigeon (v0.2.1), do not edit directly. 1 +// Autogenerated from Pigeon (v1.0.2), do not edit directly.
2 // See also: https://pub.dev/packages/pigeon 2 // See also: https://pub.dev/packages/pigeon
3 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import 3 // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import
4 // @dart = 2.12 4 // @dart = 2.12
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; 6 import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
  7 +import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
7 import 'package:flutter/services.dart'; 8 import 'package:flutter/services.dart';
8 import 'package:flutter_test/flutter_test.dart'; 9 import 'package:flutter_test/flutter_test.dart';
9 10
10 import 'package:wakelock_platform_interface/messages.dart'; 11 import 'package:wakelock_platform_interface/messages.dart';
11 12
  13 +class _TestWakelockApiCodec extends StandardMessageCodec {
  14 + const _TestWakelockApiCodec();
  15 + @override
  16 + void writeValue(WriteBuffer buffer, Object? value) {
  17 + if (value is IsEnabledMessage) {
  18 + buffer.putUint8(128);
  19 + writeValue(buffer, value.encode());
  20 + } else if (value is ToggleMessage) {
  21 + buffer.putUint8(129);
  22 + writeValue(buffer, value.encode());
  23 + } else {
  24 + super.writeValue(buffer, value);
  25 + }
  26 + }
  27 +
  28 + @override
  29 + Object? readValueOfType(int type, ReadBuffer buffer) {
  30 + switch (type) {
  31 + case 128:
  32 + return IsEnabledMessage.decode(readValue(buffer)!);
  33 +
  34 + case 129:
  35 + return ToggleMessage.decode(readValue(buffer)!);
  36 +
  37 + default:
  38 + return super.readValueOfType(type, buffer);
  39 + }
  40 + }
  41 +}
  42 +
12 abstract class TestWakelockApi { 43 abstract class TestWakelockApi {
13 - void toggle(ToggleMessage arg); 44 + static const MessageCodec<Object?> codec = _TestWakelockApiCodec();
  45 +
  46 + void toggle(ToggleMessage msg);
14 IsEnabledMessage isEnabled(); 47 IsEnabledMessage isEnabled();
15 static void setup(TestWakelockApi? api) { 48 static void setup(TestWakelockApi? api) {
16 { 49 {
17 const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( 50 const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
18 - 'dev.flutter.pigeon.WakelockApi.toggle', StandardMessageCodec()); 51 + 'dev.flutter.pigeon.WakelockApi.toggle', codec);
19 if (api == null) { 52 if (api == null) {
20 channel.setMockMessageHandler(null); 53 channel.setMockMessageHandler(null);
21 } else { 54 } else {
22 channel.setMockMessageHandler((Object? message) async { 55 channel.setMockMessageHandler((Object? message) async {
23 assert(message != null, 56 assert(message != null,
24 - 'Argument for dev.flutter.pigeon.WakelockApi.toggle was null. Expected ToggleMessage.');  
25 - final ToggleMessage input = ToggleMessage.decode(message!);  
26 - api.toggle(input); 57 + 'Argument for dev.flutter.pigeon.WakelockApi.toggle was null.');
  58 + final List<Object?> args = (message as List<Object?>?)!;
  59 + final ToggleMessage? arg_msg = args[0] as ToggleMessage?;
  60 + assert(arg_msg != null,
  61 + 'Argument for dev.flutter.pigeon.WakelockApi.toggle was null, expected non-null ToggleMessage.');
  62 + api.toggle(arg_msg!);
27 return <Object?, Object?>{}; 63 return <Object?, Object?>{};
28 }); 64 });
29 } 65 }
30 } 66 }
31 { 67 {
32 const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( 68 const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
33 - 'dev.flutter.pigeon.WakelockApi.isEnabled', StandardMessageCodec()); 69 + 'dev.flutter.pigeon.WakelockApi.isEnabled', codec);
34 if (api == null) { 70 if (api == null) {
35 channel.setMockMessageHandler(null); 71 channel.setMockMessageHandler(null);
36 } else { 72 } else {
37 channel.setMockMessageHandler((Object? message) async { 73 channel.setMockMessageHandler((Object? message) async {
38 // ignore message 74 // ignore message
39 final IsEnabledMessage output = api.isEnabled(); 75 final IsEnabledMessage output = api.isEnabled();
40 - return <Object?, Object?>{'result': output.encode()}; 76 + return <Object?, Object?>{'result': output};
41 }); 77 });
42 } 78 }
43 } 79 }
@@ -34,13 +34,13 @@ void main() { @@ -34,13 +34,13 @@ void main() {
34 test('Cannot be implemented with `implements`', () { 34 test('Cannot be implemented with `implements`', () {
35 expect(() { 35 expect(() {
36 WakelockPlatformInterface.instance = 36 WakelockPlatformInterface.instance =
37 - ImplementsWakelockPlatformInterface(false); 37 + const ImplementsWakelockPlatformInterface(false);
38 }, throwsA(isInstanceOf<NoSuchMethodError>())); 38 }, throwsA(isInstanceOf<NoSuchMethodError>()));
39 }); 39 });
40 40
41 test('Can be mocked with `implements`', () { 41 test('Can be mocked with `implements`', () {
42 WakelockPlatformInterface.instance = 42 WakelockPlatformInterface.instance =
43 - ImplementsWakelockPlatformInterface(true); 43 + const ImplementsWakelockPlatformInterface(true);
44 }); 44 });
45 45
46 test('Can be extended', () { 46 test('Can be extended', () {
  1 +## 0.2.0+3
  2 +
  3 +* Upgraded lints.
  4 +
1 ## 0.2.0+2 5 ## 0.2.0+2
2 6
3 * Updated GitHub references to use `main` instead of `master`. 7 * Updated GitHub references to use `main` instead of `master`.
@@ -41,13 +41,13 @@ Future<void> _importJSLibraries(List<String> libraries) { @@ -41,13 +41,13 @@ Future<void> _importJSLibraries(List<String> libraries) {
41 final loading = <Future<void>>[]; 41 final loading = <Future<void>>[];
42 final head = html.querySelector('head'); 42 final head = html.querySelector('head');
43 43
44 - libraries.forEach((String library) { 44 + for (final library in libraries) {
45 if (!_isImported(library)) { 45 if (!_isImported(library)) {
46 final scriptTag = _createScriptTag(library); 46 final scriptTag = _createScriptTag(library);
47 head!.children.add(scriptTag); 47 head!.children.add(scriptTag);
48 loading.add(scriptTag.onLoad.first); 48 loading.add(scriptTag.onLoad.first);
49 } 49 }
50 - }); 50 + }
51 51
52 return Future.wait(loading); 52 return Future.wait(loading);
53 } 53 }
1 name: wakelock_web 1 name: wakelock_web
2 description: Web platform implementation of the wakelock_platform_interface for the wakelock plugin. 2 description: Web platform implementation of the wakelock_platform_interface for the wakelock plugin.
3 -version: 0.2.0+2 3 +version: 0.2.0+3
4 homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock_web 4 homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock_web
5 5
6 environment: 6 environment:
@@ -21,7 +21,7 @@ dev_dependencies: @@ -21,7 +21,7 @@ dev_dependencies:
21 flutter_test: 21 flutter_test:
22 sdk: flutter 22 sdk: flutter
23 23
24 - pedantic: ^1.11.0 24 + flutter_lints: ^1.0.4
25 25
26 wakelock: 26 wakelock:
27 path: ../wakelock 27 path: ../wakelock
  1 +## 0.1.0+2
  2 +
  3 +* Upgraded lints.
  4 +
1 ## 0.1.0+1 5 ## 0.1.0+1
2 6
3 * Updated GitHub references to use `main` instead of `master`. 7 * Updated GitHub references to use `main` instead of `master`.
@@ -8,11 +8,13 @@ import 'package:win32/win32.dart'; @@ -8,11 +8,13 @@ import 'package:win32/win32.dart';
8 /// cleared. 8 /// cleared.
9 /// 9 ///
10 /// See https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate#parameters. 10 /// See https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate#parameters.
  11 +// ignore: constant_identifier_names
11 const _ES_CONTINUOUS = 0x80000000; 12 const _ES_CONTINUOUS = 0x80000000;
12 13
13 /// Forces the display to be on by resetting the display idle timer. 14 /// Forces the display to be on by resetting the display idle timer.
14 /// 15 ///
15 /// See https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate#parameters. 16 /// See https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate#parameters.
  17 +// ignore: constant_identifier_names
16 const _ES_DISPLAY_REQUIRED = 0x00000002; 18 const _ES_DISPLAY_REQUIRED = 0x00000002;
17 19
18 /// The Windows implementation of the [WakelockPlatformInterface]. 20 /// The Windows implementation of the [WakelockPlatformInterface].
1 name: wakelock_windows 1 name: wakelock_windows
2 description: >-2 2 description: >-2
3 Windows platform implementation of the wakelock_platform_interface for the wakelock plugin. 3 Windows platform implementation of the wakelock_platform_interface for the wakelock plugin.
4 -version: 0.1.0+1 4 +version: 0.1.0+2
5 homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock_windows 5 homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock_windows
6 6
7 environment: 7 environment:
@@ -19,7 +19,7 @@ dev_dependencies: @@ -19,7 +19,7 @@ dev_dependencies:
19 flutter_test: 19 flutter_test:
20 sdk: flutter 20 sdk: flutter
21 21
22 - pedantic: ^1.11.0 22 + flutter_lints: ^1.0.4
23 23
24 # todo: use dartPluginClass declaration once that lands on stable (https://github.com/flutter/flutter/issues/52267_ 24 # todo: use dartPluginClass declaration once that lands on stable (https://github.com/flutter/flutter/issues/52267_
25 #flutter: 25 #flutter:
@@ -9,7 +9,7 @@ void main() { @@ -9,7 +9,7 @@ void main() {
9 // before being published. For that, we use dependency overrides in the 9 // before being published. For that, we use dependency overrides in the
10 // example app. 10 // example app.
11 test('stub', () { 11 test('stub', () {
12 - final acceptUnitTestingDefeat = true; 12 + const acceptUnitTestingDefeat = true;
13 expect(acceptUnitTestingDefeat, isTrue); 13 expect(acceptUnitTestingDefeat, isTrue);
14 }); 14 });
15 } 15 }