Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 6a9de4f

Browse files
[path_provider] Fix Android compatibility with 2.5 (#4637)
PR #4617 added a dependency on Dart auto-registration, but forgot to bump the SDK requirement to 2.8 (where that feature was introduced for Android). In order to fix older versions, this restores the previous channel name so that the implementation here is compatible with the default method channel registration used by Flutter 2.5 and earlier. A follow-up will restore the package-specific channel name, but also change the SDK requirement to >=2.8. This must be published first so that the last published version that claims 2.5 compatibility actually works with 2.5. Fixes flutter/flutter#95706
1 parent 0619c3a commit 6a9de4f

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

packages/path_provider/path_provider_android/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.0.11
2+
3+
* Temporarily reverts the platform channel name change from 2.0.10 in order to
4+
restore compatibility with Flutter versions earlier than 2.8.
5+
16
## 2.0.10
27

38
* Switches to a package-internal implementation of the platform interface.

packages/path_provider/path_provider_android/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void getApplicationSupportDirectory(@NonNull Result result) {
153153
public PathProviderPlugin() {}
154154

155155
private void setup(BinaryMessenger messenger, Context context) {
156-
String channelName = "plugins.flutter.io/path_provider_android";
156+
String channelName = "plugins.flutter.io/path_provider";
157157
// TODO(gaaclarke): Remove reflection guard when https://github.com/flutter/engine/pull/29147
158158
// becomes available on the stable branch.
159159
try {

packages/path_provider/path_provider_android/lib/path_provider_android.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class PathProviderAndroid extends PathProviderPlatform {
1111
/// The method channel used to interact with the native platform.
1212
@visibleForTesting
1313
MethodChannel methodChannel =
14-
const MethodChannel('plugins.flutter.io/path_provider_android');
14+
const MethodChannel('plugins.flutter.io/path_provider');
1515

1616
/// Registers this class as the default instance of [PathProviderPlatform].
1717
static void registerWith() {

packages/path_provider/path_provider_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: path_provider_android
22
description: Android implementation of the path_provider plugin.
33
repository: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
5-
version: 2.0.10
5+
version: 2.0.11
66

77
environment:
88
sdk: ">=2.14.0 <3.0.0"

packages/path_provider/path_provider_android/test/path_provider_android_test.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ void main() {
5252
log.clear();
5353
});
5454

55+
// TODO(stuartmorgan): Change this to a test that it uses a different name,
56+
// to avoid potential confusion, once the SDK is changed to 2.8+. See
57+
// https://github.com/flutter/plugins/pull/4617#discussion_r774673962
58+
test('channel name is compatible with shared method channel', () async {
59+
expect(
60+
pathProvider.methodChannel.name, 'plugins.flutter.io/path_provider');
61+
});
62+
5563
test('getTemporaryPath', () async {
5664
final String? path = await pathProvider.getTemporaryPath();
5765
expect(

0 commit comments

Comments
 (0)