Skip to content

Commit b1e2fb0

Browse files
[path_provider] Convert iOS/macOS to FFI package (#9762)
Converts `path_provider_foundation` from a Flutter plugin to a Dart-only package using `ffigen` to call into Foundation directly. Most of the Dart unit tests had to be converted to integration tests, although they are still conceptually unit tests (i.e., they still inject mocks for the platform calls). This is because unlike Pigeon, where the API layer being mocked uses Dart types, the FFI calls that we now mock use Obj-C types, and those don't exist outside of an actual app runtime, so the integration test driver is the only place they can be hosted. This is very similar to how most of our web plugin implementations are unit tested. Fixes flutter/flutter#111033 ## 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 0413344 commit b1e2fb0

File tree

26 files changed

+1414
-916
lines changed

26 files changed

+1414
-916
lines changed

packages/path_provider/path_provider_foundation/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.5.0
2+
3+
* Replaces Flutter-plugin-based implementation with direct FFI calls to
4+
Foundation.
5+
16
## 2.4.4
27

38
* Updates to Pigeon 26.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Contributing
2+
3+
## `ffigen`
4+
5+
This package uses [ffigen](https://pub.dev/packages/ffigen) to call Foundation
6+
methods, rather than using the standard Flutter plugin structure. To add new
7+
functionality to the FFI interface, update `tool/ffigen.dart`, then run:
8+
9+
```bash
10+
dart run tool/ffigen.dart
11+
```
12+
13+
### Configuration philosophy
14+
15+
This package intentionally uses very strict filtering rules to include only the
16+
necessary methods and functions. This is partially to keep the package small,
17+
but mostly to avoid unnecessarily generating anything that requires native code
18+
helpers, which would require setting up a native compilation step.

packages/path_provider/path_provider_foundation/darwin/RunnerTests/RunnerTests.swift

Lines changed: 0 additions & 90 deletions
This file was deleted.

packages/path_provider/path_provider_foundation/darwin/path_provider_foundation.podspec

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/path_provider/path_provider_foundation/darwin/path_provider_foundation/Package.swift

Lines changed: 0 additions & 28 deletions
This file was deleted.

packages/path_provider/path_provider_foundation/darwin/path_provider_foundation/Sources/path_provider_foundation/PathProviderPlugin.swift

Lines changed: 0 additions & 75 deletions
This file was deleted.

packages/path_provider/path_provider_foundation/darwin/path_provider_foundation/Sources/path_provider_foundation/Resources/PrivacyInfo.xcprivacy

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)