Skip to content

Commit 644b57d

Browse files
committed
style: fix style errors in example app and library
1 parent 437be58 commit 644b57d

File tree

14 files changed

+48
-57
lines changed

14 files changed

+48
-57
lines changed

analysis_options.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
include: package:flutter_lints/flutter.yaml
22

33
# Additional information about this file can be found at
4+
# https://dart.dev/tools/analysis
5+
# https://pub.dev/packages/flutter_lints
46
# https://dart.dev/guides/language/analysis-options
7+
8+
# To run this file, run `flutter analyze` or `mise lint`
9+
10+
analyzer:
11+
# generated code
12+
exclude: ["test/serialization/push_api_test.dart"]

android/src/main/kotlin/uk/orth/push/serialization/PushApi.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,12 +567,12 @@ class PushFlutterApi(private val binaryMessenger: BinaryMessenger, private val m
567567
* Hint: You can still include the title, body or other metadata in your
568568
* data payload to identify what notification the user tapped on.
569569
*/
570-
fun onNotificationTap(dataArg: Map<String?, Any?>, callback: (Result<Unit>) -> Unit)
570+
fun onNotificationTap(messageArg: Map<String?, Any?>, callback: (Result<Unit>) -> Unit)
571571
{
572572
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
573573
val channelName = "dev.flutter.pigeon.push.PushFlutterApi.onNotificationTap$separatedMessageChannelSuffix"
574574
val channel = BasicMessageChannel<Any?>(binaryMessenger, channelName, codec)
575-
channel.send(listOf(dataArg)) {
575+
channel.send(listOf(messageArg)) {
576576
if (it is List<*>) {
577577
if (it.size > 1) {
578578
callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))

darwin/Classes/serialization/PushApi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ extern void SetUpPUPushHostApiWithSuffix(id<FlutterBinaryMessenger> binaryMessen
179179
///
180180
/// Hint: You can still include the title, body or other metadata in your
181181
/// data payload to identify what notification the user tapped on.
182-
- (void)onNotificationTapData:(NSDictionary<NSString *, id> *)data completion:(void (^)(FlutterError *_Nullable))completion;
182+
- (void)onNotificationTapMessage:(NSDictionary<NSString *, id> *)message completion:(void (^)(FlutterError *_Nullable))completion;
183183
- (void)onNewTokenToken:(NSString *)token completion:(void (^)(FlutterError *_Nullable))completion;
184184
- (void)onOpenNotificationSettingsWithCompletion:(void (^)(FlutterError *_Nullable))completion;
185185
@end

darwin/Classes/serialization/PushApi.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,14 +555,14 @@ - (void)onBackgroundMessageMessage:(PURemoteMessage *)arg_message completion:(vo
555555
}
556556
}];
557557
}
558-
- (void)onNotificationTapData:(NSDictionary<NSString *, id> *)arg_data completion:(void (^)(FlutterError *_Nullable))completion {
558+
- (void)onNotificationTapMessage:(NSDictionary<NSString *, id> *)arg_message completion:(void (^)(FlutterError *_Nullable))completion {
559559
NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.push.PushFlutterApi.onNotificationTap", _messageChannelSuffix];
560560
FlutterBasicMessageChannel *channel =
561561
[FlutterBasicMessageChannel
562562
messageChannelWithName:channelName
563563
binaryMessenger:self.binaryMessenger
564564
codec:PUGetPushApiCodec()];
565-
[channel sendMessage:@[arg_data ?: [NSNull null]] reply:^(NSArray<id> *reply) {
565+
[channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray<id> *reply) {
566566
if (reply != nil) {
567567
if (reply.count > 1) {
568568
completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]);

example/analysis_options.yaml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
1-
# This file configures the analyzer, which statically analyzes Dart code to
2-
# check for errors, warnings, and lints.
3-
#
4-
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5-
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6-
# invoked from the command line by running `flutter analyze`.
7-
8-
# The following line activates a set of recommended lints for Flutter apps,
9-
# packages, and plugins designed to encourage good coding practices.
101
include: package:flutter_lints/flutter.yaml
112

12-
linter:
13-
# The lint rules applied to this project can be customized in the
14-
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15-
# included above or to enable additional rules. A list of all available lints
16-
# and their documentation is published at
17-
# https://dart-lang.github.io/linter/lints/index.html.
18-
#
19-
# Instead of disabling a lint rule for the entire project in the
20-
# section below, it can also be suppressed for a single line of code
21-
# or a specific dart file by using the `// ignore: name_of_lint` and
22-
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23-
# producing the lint.
24-
rules:
25-
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26-
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27-
283
# Additional information about this file can be found at
4+
# https://dart.dev/tools/analysis
5+
# https://pub.dev/packages/flutter_lints
296
# https://dart.dev/guides/language/analysis-options
7+
8+
linter:
9+
rules:
10+
# Printing is useful for developers in this example app
11+
avoid_print: false

example/lib/metadata_sliver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class MetadataSliver extends HookWidget {
6161
Expanded(child: Text(pushToken.value.toString()))
6262
],
6363
),
64-
DarwinRegisterUnregisterWidget()
64+
const DarwinRegisterUnregisterWidget()
6565
],
6666
),
6767
);

example/lib/notification_permission_sliver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:push/push.dart';
66
import 'package:push_example/text_row.dart';
77

88
class NotificationPermissionSliver extends HookWidget {
9-
const NotificationPermissionSliver({Key? key}) : super(key: key);
9+
const NotificationPermissionSliver({super.key});
1010

1111
@override
1212
Widget build(BuildContext context) {

example/lib/remote_message_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:push_example/text_row.dart';
55
class RemoteMessageWidget extends StatelessWidget {
66
final RemoteMessage? remoteMessage;
77

8-
const RemoteMessageWidget(this.remoteMessage, {Key? key}) : super(key: key);
8+
const RemoteMessageWidget(this.remoteMessage, {super.key});
99

1010
@override
1111
Widget build(BuildContext context) {

example/lib/remote_messages_widget.dart

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:push_example/text_row.dart';
55
class RemoteMessagesWidget extends StatelessWidget {
66
final List<RemoteMessage> remoteMessages;
77

8-
const RemoteMessagesWidget(this.remoteMessages, {Key? key}) : super(key: key);
8+
const RemoteMessagesWidget(this.remoteMessages, {super.key});
99

1010
@override
1111
Widget build(BuildContext context) {
@@ -14,19 +14,17 @@ class RemoteMessagesWidget extends StatelessWidget {
1414
}
1515
return Column(
1616
children: [
17-
...remoteMessages
18-
.map((message) => Padding(
19-
padding: const EdgeInsets.symmetric(vertical: 4),
20-
child: Column(
21-
crossAxisAlignment: CrossAxisAlignment.stretch,
22-
children: [
23-
TextRow("Title", message.notification?.title.toString()),
24-
TextRow("Body", message.notification?.body.toString()),
25-
TextRow("Data", message.data?.toString())
26-
],
27-
),
28-
))
29-
.toList()
17+
...remoteMessages.map((message) => Padding(
18+
padding: const EdgeInsets.symmetric(vertical: 4),
19+
child: Column(
20+
crossAxisAlignment: CrossAxisAlignment.stretch,
21+
children: [
22+
TextRow("Title", message.notification?.title.toString()),
23+
TextRow("Body", message.notification?.body.toString()),
24+
TextRow("Data", message.data?.toString())
25+
],
26+
),
27+
))
3028
],
3129
);
3230
}

example/lib/text_row.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class TextRow extends StatelessWidget {
66
final String label;
77
final String? text;
88

9-
const TextRow(this.label, this.text, {Key? key}) : super(key: key);
9+
const TextRow(this.label, this.text, {super.key});
1010

1111
@override
1212
Widget build(BuildContext context) => RichText(

0 commit comments

Comments
 (0)