Skip to content

Commit b33d933

Browse files
[pigeon] Fixes lint error from unused codec (#12512)
Part of fixing flutter/flutter#183945. Regenerating pigeon files will fix issue. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 538239f commit b33d933

5 files changed

Lines changed: 82 additions & 3 deletions

File tree

‎packages/pigeon/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 27.3.2
2+
3+
* [dart] Fixes lint warning from unused codec variable in Dart proxy classes.
4+
15
## 27.3.1
26

37
* Updates `analyzer` dependency to support versions 13 and 14.

‎packages/pigeon/lib/src/dart/dart_generator.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ final BinaryMessenger? ${varNamePrefix}binaryMessenger;
960960
..fields.addAll(<cb.Field>[
961961
if (api.constructors.isNotEmpty ||
962962
api.attachedFields.any((ApiField field) => !field.isStatic) ||
963-
api.hostMethods.isNotEmpty)
963+
api.hostMethods.any((Method method) => !method.isStatic))
964964
proxy_api_helper.codecInstanceField(
965965
codecInstanceName: codecInstanceName,
966966
codecName: codecName,

‎packages/pigeon/lib/src/generator_tools.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'generator.dart';
1515
/// The current version of pigeon.
1616
///
1717
/// This must match the version in pubspec.yaml.
18-
const String pigeonVersion = '27.3.1';
18+
const String pigeonVersion = '27.3.2';
1919

2020
/// Default plugin package name.
2121
const String defaultPluginPackageName = 'dev.flutter.pigeon';

‎packages/pigeon/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: pigeon
22
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
33
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
5-
version: 27.3.1 # This must match the version in lib/src/generator_tools.dart
5+
version: 27.3.2 # This must match the version in lib/src/generator_tools.dart
66

77
environment:
88
sdk: ^3.11.0

‎packages/pigeon/test/dart/proxy_api_test.dart‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,81 @@ void main() {
10281028
);
10291029
});
10301030
});
1031+
1032+
group('codec instance variable', () {
1033+
test('proxy api only contains a non-static host method', () {
1034+
final root = Root(
1035+
apis: <Api>[
1036+
AstProxyApi(
1037+
name: 'Api',
1038+
constructors: <Constructor>[],
1039+
fields: <ApiField>[],
1040+
methods: <Method>[
1041+
Method(
1042+
name: 'method',
1043+
returnType: const TypeDeclaration.voidDeclaration(),
1044+
parameters: <Parameter>[],
1045+
location: .host,
1046+
),
1047+
],
1048+
),
1049+
],
1050+
classes: <Class>[],
1051+
enums: <Enum>[],
1052+
);
1053+
final sink = StringBuffer();
1054+
const generator = DartGenerator();
1055+
generator.generate(
1056+
const InternalDartOptions(ignoreLints: false),
1057+
root,
1058+
sink,
1059+
dartPackageName: DEFAULT_PACKAGE_NAME,
1060+
);
1061+
1062+
final String collapsedCode = _collapseNewlineAndIndentation(sink.toString());
1063+
expect(
1064+
collapsedCode,
1065+
contains('late final _PigeonInternalProxyApiBaseCodec _pigeonVar_codecApi'),
1066+
);
1067+
});
1068+
1069+
test('proxy api only contains a static host method', () {
1070+
final root = Root(
1071+
apis: <Api>[
1072+
AstProxyApi(
1073+
name: 'Api',
1074+
constructors: <Constructor>[],
1075+
fields: <ApiField>[],
1076+
methods: <Method>[
1077+
Method(
1078+
name: 'method',
1079+
returnType: const TypeDeclaration.voidDeclaration(),
1080+
parameters: <Parameter>[],
1081+
location: .host,
1082+
isStatic: true,
1083+
),
1084+
],
1085+
),
1086+
],
1087+
classes: <Class>[],
1088+
enums: <Enum>[],
1089+
);
1090+
final sink = StringBuffer();
1091+
const generator = DartGenerator();
1092+
generator.generate(
1093+
const InternalDartOptions(ignoreLints: false),
1094+
root,
1095+
sink,
1096+
dartPackageName: DEFAULT_PACKAGE_NAME,
1097+
);
1098+
1099+
final String collapsedCode = _collapseNewlineAndIndentation(sink.toString());
1100+
expect(
1101+
collapsedCode,
1102+
isNot(contains('late final _PigeonInternalProxyApiBaseCodec _pigeonVar_codecApi')),
1103+
);
1104+
});
1105+
});
10311106
});
10321107
}
10331108

0 commit comments

Comments
 (0)