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

Commit

Permalink
[path_provider] Fix Android compatibility with 2.5 (#4637)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stuartmorgan committed Dec 23, 2021
1 parent 0619c3a commit 6a9de4f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/path_provider/path_provider_android/CHANGELOG.md
@@ -1,3 +1,8 @@
## 2.0.11

* Temporarily reverts the platform channel name change from 2.0.10 in order to
restore compatibility with Flutter versions earlier than 2.8.

## 2.0.10

* Switches to a package-internal implementation of the platform interface.
Expand Down
Expand Up @@ -153,7 +153,7 @@ public void getApplicationSupportDirectory(@NonNull Result result) {
public PathProviderPlugin() {}

private void setup(BinaryMessenger messenger, Context context) {
String channelName = "plugins.flutter.io/path_provider_android";
String channelName = "plugins.flutter.io/path_provider";
// TODO(gaaclarke): Remove reflection guard when https://github.com/flutter/engine/pull/29147
// becomes available on the stable branch.
try {
Expand Down
Expand Up @@ -11,7 +11,7 @@ class PathProviderAndroid extends PathProviderPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
MethodChannel methodChannel =
const MethodChannel('plugins.flutter.io/path_provider_android');
const MethodChannel('plugins.flutter.io/path_provider');

/// Registers this class as the default instance of [PathProviderPlatform].
static void registerWith() {
Expand Down
2 changes: 1 addition & 1 deletion packages/path_provider/path_provider_android/pubspec.yaml
Expand Up @@ -2,7 +2,7 @@ name: path_provider_android
description: Android implementation of the path_provider plugin.
repository: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
version: 2.0.10
version: 2.0.11

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down
Expand Up @@ -52,6 +52,14 @@ void main() {
log.clear();
});

// TODO(stuartmorgan): Change this to a test that it uses a different name,
// to avoid potential confusion, once the SDK is changed to 2.8+. See
// https://github.com/flutter/plugins/pull/4617#discussion_r774673962
test('channel name is compatible with shared method channel', () async {
expect(
pathProvider.methodChannel.name, 'plugins.flutter.io/path_provider');
});

test('getTemporaryPath', () async {
final String? path = await pathProvider.getTemporaryPath();
expect(
Expand Down

0 comments on commit 6a9de4f

Please sign in to comment.