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

Commit 0fab93d

Browse files
authored
[path_provider] Updated documentation reflecting changes needed for testing (#2815)
The recent federation of the Linux path provider might break tests, this updates the README.md to address those changes and direct the users how to mock the plugin in their tests.
1 parent ff53b70 commit 0fab93d

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

packages/path_provider/path_provider/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.6.11
2+
* Updated documentation to reflect the need for changes in testing for federated plugins
3+
14
## 1.6.10
25
* Linux implementation endorsement
36

packages/path_provider/path_provider/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
[![pub package](https://img.shields.io/pub/v/path_provider.svg)](https://pub.dartlang.org/packages/path_provider)
44

5-
A Flutter plugin for finding commonly used locations on the filesystem. Supports iOS and Android.
5+
A Flutter plugin for finding commonly used locations on the filesystem. Supports iOS, Android, Linux and MacOS.
6+
Not all methods are supported on all platforms.
67

78
## Usage
89

@@ -19,3 +20,17 @@ String appDocPath = appDocDir.path;
1920
```
2021

2122
Please see the example app of this plugin for a full example.
23+
24+
### Usage in tests
25+
26+
`path_provider` now uses a `PlatformInterface`, meaning that not all platforms share the a single `PlatformChannel`-based implementation.
27+
With that change, tests should be updated to mock `PathProviderPlatform` rather than `PlatformChannel`.
28+
29+
See this `path_provider` [test](https://github.com/flutter/plugins/blob/master/packages/path_provider/path_provider/test/path_provider_test.dart) for an example.
30+
31+
You will also have to temporarily add the following line to the setup of your test.
32+
```dart
33+
disablePathProviderPlatformOverride = true;
34+
```
35+
36+
See this [issue](https://github.com/flutter/flutter/issues/52267), for more details on why this is needed.

packages/path_provider/path_provider/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: path_provider
22
description: Flutter plugin for getting commonly used locations on the Android &
33
iOS file systems, such as the temp and app data directories.
44
homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider
5-
version: 1.6.10
5+
version: 1.6.11
66

77
flutter:
88
plugin:

0 commit comments

Comments
 (0)