Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
440 commits
Select commit Hold shift + click to select a range
6a2c35e
add self as codeowner
bparrishMines Feb 12, 2026
2d501a2
update dependabot
bparrishMines Feb 12, 2026
7f40e97
fix project validations
bparrishMines Feb 13, 2026
30b062a
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Feb 13, 2026
e2d0f15
change to scoped storage for darwin
bparrishMines Feb 13, 2026
7b34f3d
formatting and fix excerpts
bparrishMines Feb 13, 2026
52fbbaa
fix readme and add convenience method to scopedstorage files
bparrishMines Feb 13, 2026
4c15493
add more info on scoped storage
bparrishMines Feb 13, 2026
3075896
add darwin tests
bparrishMines Feb 17, 2026
4b0b3e4
update gradle and change to publish_to
bparrishMines Feb 17, 2026
6b721eb
add integration test harness
bparrishMines Feb 17, 2026
789ef71
change web to publish to none
bparrishMines Feb 17, 2026
1b24e78
fix web for wasm
bparrishMines Feb 17, 2026
1d1e949
formatting
bparrishMines Feb 17, 2026
b623ad4
change settings file to groovy
bparrishMines Feb 17, 2026
f420e80
publish too
bparrishMines Feb 17, 2026
6415ea6
add new files
bparrishMines Feb 17, 2026
00a9f10
add example app
bparrishMines Feb 17, 2026
5fc9cd5
update project gradles
bparrishMines Feb 17, 2026
79a98cb
add dart integration test file
bparrishMines Feb 17, 2026
fe48304
improve pubspecs and add test drivers
bparrishMines Feb 17, 2026
8a5d3cc
fix darwin tests
bparrishMines Feb 17, 2026
a234ecd
update interface
bparrishMines Feb 17, 2026
9765b61
web update
bparrishMines Feb 17, 2026
54d0668
update darwin
bparrishMines Feb 17, 2026
b276f77
update android
bparrishMines Feb 17, 2026
9eeb9ed
update io
bparrishMines Feb 17, 2026
ac3dcf0
update cross_file
bparrishMines Feb 17, 2026
ae1f8e0
format and excerpts
bparrishMines Feb 17, 2026
409a17d
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Feb 17, 2026
bae2e4d
fix darwin tests
bparrishMines Feb 17, 2026
6ec9c3f
update darwin and io to maybe run on windows
bparrishMines Feb 17, 2026
15f311e
add convenience method for cross_File
bparrishMines Feb 17, 2026
b4799e8
remove android integration endpoint
bparrishMines Feb 17, 2026
a04ebd4
update baseline
bparrishMines Feb 17, 2026
920bb31
delete old test
bparrishMines Feb 17, 2026
11efbdc
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Feb 17, 2026
f19b74e
remove can read from xfile
bparrishMines Feb 17, 2026
f01d4bd
remove old pubspec and example
bparrishMines Feb 17, 2026
9ca64a7
remove runner tests
bparrishMines Feb 17, 2026
bd73776
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Feb 18, 2026
b70935c
remove bookmark uri logic
bparrishMines Feb 18, 2026
a0c2fd4
add config
bparrishMines Feb 25, 2026
c37af83
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Feb 25, 2026
e4d1d26
try global
bparrishMines Feb 25, 2026
28b1679
missing apostrophe
bparrishMines Feb 27, 2026
d845bcb
update platform xdirectory
bparrishMines Mar 2, 2026
a6f8336
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Mar 2, 2026
c58f31b
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Apr 1, 2026
7ecfd3a
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Apr 21, 2026
574eb1a
update gradles to kotlins
bparrishMines Apr 21, 2026
a0169fb
add a test
bparrishMines Apr 21, 2026
340c462
remove generated files
bparrishMines Apr 21, 2026
a1a621c
remove generated files
bparrishMines Apr 21, 2026
7c2ad19
update project
bparrishMines Apr 21, 2026
b3ebbf5
remove ref
bparrishMines Apr 21, 2026
bb8b149
remove pods
bparrishMines Apr 21, 2026
48bd7e0
remove runnertests refernces
bparrishMines Apr 21, 2026
ef0b7fc
add a is current implementation
bparrishMines Apr 21, 2026
4104693
update exerpts
bparrishMines Apr 21, 2026
b4a47f4
change to use maybe get extension
bparrishMines Apr 21, 2026
58678a4
add comment
bparrishMines Apr 21, 2026
784192d
use internal to hide platform use
bparrishMines Apr 21, 2026
8ac420c
typo an extra can read test
bparrishMines Apr 21, 2026
170f6b0
todo and version setting
bparrishMines Apr 21, 2026
7fee973
change version of platform interface
bparrishMines Apr 21, 2026
7390bfc
Pr feedback
bparrishMines Apr 21, 2026
3cf62e9
authors
bparrishMines Apr 21, 2026
08707df
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Apr 21, 2026
3f2f880
call stop automatically with finalizer
bparrishMines Apr 21, 2026
f9ba45a
change all to platformxentity and xentity
bparrishMines Apr 21, 2026
761fba6
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Apr 21, 2026
4a49a21
formatting
bparrishMines Apr 21, 2026
30210f1
sort exports
bparrishMines Apr 21, 2026
0115b47
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Apr 21, 2026
a388a69
add xcconfig back
bparrishMines Apr 22, 2026
a6af73c
add missing xcconfigs
bparrishMines Apr 22, 2026
c93bb93
add finalizer to ios directory
bparrishMines Apr 22, 2026
8fecd6a
fix test
bparrishMines Apr 22, 2026
15707ad
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Apr 22, 2026
531dc5c
remove dupe canread test
bparrishMines Apr 22, 2026
194a323
add dart test yaml
bparrishMines Apr 22, 2026
1a54c91
add comment
bparrishMines Apr 22, 2026
5033f3f
add canread to scopedstoragecrossdirectory
bparrishMines Apr 23, 2026
fb21706
remove config file
bparrishMines Apr 23, 2026
ff2d369
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Apr 30, 2026
a3994c1
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines May 5, 2026
939a1c0
make classes base
bparrishMines May 5, 2026
c62eb16
fix class name refs
bparrishMines May 5, 2026
bc28494
add photokit scaffolding in dart
bparrishMines May 6, 2026
ef08bac
darwin api stuffc
bparrishMines May 7, 2026
4c34286
partial impl for darwin
bparrishMines May 7, 2026
afe1231
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines May 27, 2026
df66b02
update pubspec sdk versions
bparrishMines May 27, 2026
c1c066f
update darwin xfile docs
bparrishMines May 29, 2026
3d9f91e
update directory to be similar to file
bparrishMines May 29, 2026
a408ce9
add ffi to pubspec
bparrishMines May 29, 2026
71f72fe
update for ffigen
bparrishMines Jun 2, 2026
77a0132
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 2, 2026
01e5d97
fix compilation
bparrishMines Jun 2, 2026
4f9feb1
fix example
bparrishMines Jun 2, 2026
32c511a
remove api and use ffi
bparrishMines Jun 2, 2026
dbee630
add phasset
bparrishMines Jun 2, 2026
9eae34c
add most api
bparrishMines Jun 2, 2026
04621c3
finish adding bindingS
bparrishMines Jun 2, 2026
eab82fc
add dynamic library
bparrishMines Jun 2, 2026
d43a862
wire up most of it
bparrishMines Jun 2, 2026
dfe9ecc
move where the data is passed to main thread
bparrishMines Jun 2, 2026
77c9cf8
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 2, 2026
abb39e2
fix library name maybe
bparrishMines Jun 2, 2026
183844d
support objc
bparrishMines Jun 2, 2026
38b2753
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 3, 2026
b36b01a
formatting and maybe implement length
bparrishMines Jun 4, 2026
d088cae
try reading from address
bparrishMines Jun 4, 2026
f9edbcd
try unsigned long
bparrishMines Jun 4, 2026
eaed7c4
add prints
bparrishMines Jun 4, 2026
dfb7ee5
try long again
bparrishMines Jun 4, 2026
ba16dfc
try ot use nsnumber
bparrishMines Jun 4, 2026
83ae934
use nsnumber
bparrishMines Jun 4, 2026
148953a
i think working algo
bparrishMines Jun 5, 2026
c4e8634
prints
bparrishMines Jun 5, 2026
4a65aa9
add some prints
bparrishMines Jun 8, 2026
e6c3e59
look at other resources
bparrishMines Jun 8, 2026
f313769
better prints
bparrishMines Jun 8, 2026
99016fe
add contentType
bparrishMines Jun 8, 2026
eaede7b
print extractor
bparrishMines Jun 8, 2026
2ebe107
print length
bparrishMines Jun 8, 2026
c22d4bc
something something
bparrishMines Jun 8, 2026
4492f9c
something something
bparrishMines Jun 8, 2026
c1fddbb
something something
bparrishMines Jun 8, 2026
dc66e88
something something
bparrishMines Jun 9, 2026
10cdaa6
something something
bparrishMines Jun 9, 2026
7544671
something something
bparrishMines Jun 9, 2026
b38c571
something something
bparrishMines Jun 9, 2026
431cf87
start of chaning open read to proxyapi
bparrishMines Jun 12, 2026
eb28858
proxy api for byte reading
bparrishMines Jun 15, 2026
6ac49c5
return true actually
bparrishMines Jun 15, 2026
2c0293d
docs and names
bparrishMines Jun 15, 2026
712bcf3
todo
bparrishMines Jun 15, 2026
b72833a
start initial test creation
bparrishMines Jun 15, 2026
f99d7ed
start writing tests
bparrishMines Jun 15, 2026
b57339c
passing test
bparrishMines Jun 15, 2026
f52b220
initial stress test
bparrishMines Jun 15, 2026
ae5434c
add tests back
bparrishMines Jun 17, 2026
42e67e6
impl tests
bparrishMines Jun 17, 2026
55eeb13
add macos tests
bparrishMines Jun 17, 2026
89e5428
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 17, 2026
8e76180
formatting and no import
bparrishMines Jun 17, 2026
4dd921b
excerpts and analyze
bparrishMines Jun 17, 2026
b63030a
analyze errors
bparrishMines Jun 17, 2026
6613d68
license
bparrishMines Jun 17, 2026
6a68362
use --platform
bparrishMines Jun 17, 2026
aa6e666
dash
bparrishMines Jun 17, 2026
5c26447
add darwin dep
bparrishMines Jun 17, 2026
6c5f597
remove configs
bparrishMines Jun 17, 2026
eba22d5
fix license
bparrishMines Jun 17, 2026
77a6224
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 17, 2026
43b9fb0
fix web test requiring SIGKILL
bparrishMines Jun 18, 2026
0f3283c
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 22, 2026
49ae634
update to use ffigen
bparrishMines Jun 23, 2026
a2d34bd
use ffigen
bparrishMines Jun 23, 2026
a7de454
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 23, 2026
8517b1b
add flutter deps
bparrishMines Jun 23, 2026
44e0676
add dart test yaml
bparrishMines Jun 23, 2026
356487a
rename to actual file name
bparrishMines Jun 23, 2026
1b2f361
delete
bparrishMines Jun 23, 2026
50cffbe
fix integration test macos
bparrishMines Jun 23, 2026
ace90a2
remove chrome requirement
bparrishMines Jun 23, 2026
a0a4c85
move tests to integration tests
bparrishMines Jun 23, 2026
44d1df6
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 23, 2026
d37cb36
add test for range filter
bparrishMines Jun 24, 2026
1627c9f
Merge branch 'main' of github.com:flutter/packages into new_crossfile
bparrishMines Jun 24, 2026
3082768
Merge branch 'main' of https://github.com/flutter/packages into new_c…
bparrishMines Jul 30, 2026
a639f71
TODO for cross_file example
bparrishMines Jul 30, 2026
dadac8b
update uri docs
bparrishMines Jul 30, 2026
b43a6f4
change to just getextension
bparrishMines Jul 30, 2026
d483557
change to entity as base
bparrishMines Jul 30, 2026
70c3058
dot comments encoding
bparrishMines Jul 30, 2026
faa0a1a
update name docs
bparrishMines Jul 30, 2026
063d776
name docs clarification path
bparrishMines Jul 30, 2026
4bea365
undo webview change
bparrishMines Jul 30, 2026
e8d9d37
fix dependabot location
bparrishMines Jul 30, 2026
568e468
update platform specific in platform interface
bparrishMines Jul 30, 2026
9bc0c65
fix platform specific in other packages
bparrishMines Jul 30, 2026
c398f3f
change to make extension sound optional
bparrishMines Jul 31, 2026
0db1cb4
update can read for directories
bparrishMines Jul 31, 2026
6dbe663
set to version 1.0
bparrishMines Jul 31, 2026
78ea879
extra newliine
bparrishMines Jul 31, 2026
d3ee6ef
you can find
bparrishMines Jul 31, 2026
0415b2e
update gradle for android to compile
bparrishMines Jul 31, 2026
e11124e
android compiles with new kotlin names
bparrishMines Jul 31, 2026
dcb56c5
unused imports
bparrishMines Jul 31, 2026
f5e8752
update ffigen
bparrishMines Jul 31, 2026
41f3a98
change android openRead to not use length and add argument errors
bparrishMines Aug 1, 2026
7e4cf13
change to exception for input stream
bparrishMines Aug 1, 2026
2cd672f
simplify darwing
bparrishMines Aug 1, 2026
1ebabfc
use reader for open read
bparrishMines Aug 2, 2026
5c95bc6
passing web integration tests
bparrishMines Aug 2, 2026
40dd018
move tests instructions to contributing
bparrishMines Aug 2, 2026
17aa449
cleanup android code a bit
bparrishMines Aug 2, 2026
a9326a7
typo
bparrishMines Aug 3, 2026
6a12a0f
remove file selector references
bparrishMines Aug 3, 2026
36822df
move test to cross_file_io
bparrishMines Aug 3, 2026
f12a724
add a breaking change
bparrishMines Aug 3, 2026
7dc7720
change to checking with a top level class with functions
bparrishMines Aug 3, 2026
50fc6f8
update changelog
bparrishMines Aug 3, 2026
9a41e2d
update gradle
bparrishMines Aug 3, 2026
2f0648b
remove android underscores
bparrishMines Aug 3, 2026
32cc69a
Merge branch 'main' of https://github.com/flutter/packages into new_c…
bparrishMines Aug 3, 2026
3daca19
remove entity export
bparrishMines Aug 3, 2026
51c4657
change to app facing package wrapper
bparrishMines Aug 3, 2026
b388939
remove web limitations
bparrishMines Aug 5, 2026
bd3df2a
comment about size chosen
bparrishMines Aug 6, 2026
497ddba
update ffi
bparrishMines Aug 6, 2026
71ac4e0
Merge branch 'main' of https://github.com/flutter/packages into new_c…
bparrishMines Aug 6, 2026
a05e328
formatting
bparrishMines Aug 6, 2026
0694a6c
add darwin contributing
bparrishMines Aug 6, 2026
74e629e
remove g
bparrishMines Aug 6, 2026
456ff27
add dispose method
bparrishMines Aug 7, 2026
5b93684
add file system impl and add test for stream errors
bparrishMines Aug 7, 2026
0e6f093
switch to range error and ensure error is sent to stream
bparrishMines Aug 7, 2026
c6ee25f
add file system to interface
bparrishMines Aug 7, 2026
f828a3b
app facing toString uses uri and change filesystem params to use path…
bparrishMines Aug 7, 2026
d33f093
update interface to handle paths
bparrishMines Aug 7, 2026
67b39aa
add path to directory as well
bparrishMines Aug 7, 2026
982e3f0
update io implementation to use file system implementation
bparrishMines Aug 7, 2026
c6c12dd
change android and ios to create an instance of io to create file system
bparrishMines Aug 7, 2026
1d884a5
add io test for android and ios
bparrishMines Aug 7, 2026
b6dee66
add file system to app facing
bparrishMines Aug 7, 2026
7e2f9a5
file system implementation in app facing
bparrishMines Aug 7, 2026
34dad20
set up file system implementation across everything
bparrishMines Aug 11, 2026
c3aeb68
accidental didn't merge
bparrishMines Aug 11, 2026
883514c
Merge branch 'main' of https://github.com/flutter/packages into new_c…
bparrishMines Aug 11, 2026
f8a8204
formatting
bparrishMines Aug 11, 2026
ab90e7a
add pigeon impl to run on macos
bparrishMines Aug 11, 2026
31348b1
add tests back
bparrishMines Aug 12, 2026
cad1509
add readbytes test
bparrishMines Aug 12, 2026
247b770
Merge branch 'main' of https://github.com/flutter/packages into new_c…
bparrishMines Aug 12, 2026
feff9f3
update excerpts
bparrishMines Aug 12, 2026
cf91564
update readme
bparrishMines Aug 12, 2026
8d7ff92
add breaking changes
bparrishMines Aug 13, 2026
87e5c74
unused import
bparrishMines Aug 13, 2026
71f7ab6
remove darwin tests that aren't used
bparrishMines Aug 13, 2026
1634e7d
formatting
bparrishMines Aug 13, 2026
cf58005
Merge branch 'main' of https://github.com/flutter/packages into new_c…
bparrishMines Aug 13, 2026
076e08e
unused import
bparrishMines Aug 13, 2026
3f6f303
add license to darwin ffi
bparrishMines Aug 13, 2026
ec62032
Revert "remove darwin tests that aren't used"
bparrishMines Aug 13, 2026
7966743
fix android tests
bparrishMines Aug 13, 2026
74a5fda
add cross_file_web because it uses chrome for flutter
bparrishMines Aug 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .ci/scripts/prepare_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ set -e
git fetch origin main
git branch main origin/main

# Enables long paths to work on Windows.
git config --global core.longpaths true

cd script/tool
dart pub get

Expand Down
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

version: 2
updates:
- package-ecosystem: "github-actions"

Check warning on line 6 in .github/dependabot.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

dependabot-cooldown

dependabot.yml:6: insufficient cooldown in Dependabot updates: missing cooldown configuration
directory: "/"
schedule:
interval: "weekly"
Expand All @@ -23,12 +23,14 @@
update-types: ["version-update:semver-patch"]

# Android example apps.
- package-ecosystem: "gradle"

Check warning on line 26 in .github/dependabot.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

dependabot-cooldown

dependabot.yml:26: insufficient cooldown in Dependabot updates: missing cooldown configuration
directories:
- /packages/animations/example/android/app
- /packages/camera/camera_android/example/android/app
- /packages/camera/camera_android_camerax/example/android/app
- /packages/camera/camera/example/android/app
- /packages/cross_file/cross_file/example/android/app
- /packages/cross_file/cross_file_android/example/android/app
- /packages/espresso/example/android/app
- /packages/extension_google_sign_in_as_googleapis_auth/example/android/app
- /packages/file_selector/file_selector/example/android/app
Expand Down Expand Up @@ -80,10 +82,11 @@
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

# Android packages (excluding example apps).
- package-ecosystem: "gradle"

Check warning on line 85 in .github/dependabot.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

dependabot-cooldown

dependabot.yml:85: insufficient cooldown in Dependabot updates: missing cooldown configuration
directories:
- /packages/camera/camera_android/android
- /packages/camera/camera_android_camerax/android
- /packages/cross_file/cross_file_android/android
- /packages/espresso/android
- /packages/file_selector/file_selector_android/android
- /packages/flutter_plugin_android_lifecycle/android
Expand Down
68 changes: 0 additions & 68 deletions packages/cross_file/README.md

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 0.4.0

* Updates `cross_file` to a package-separated federated plugin.
Comment thread
bparrishMines marked this conversation as resolved.
* Adds `XDirectory` to access file containers.
* Adds implementation for file systems. See `FileSystemXFile` and `FileSystemXDirectory`.
* Adds implementation for scoped storage APIs that use ephemeral URLS. See `ScopedStorageXFile`
and `ScopedStorageXDirectory`.
* **Breaking Change** Replaces `XFile(String path)` with `XFile.fileSystem({required String path})`
or `FileSystem(String path)`.
* **Breaking Change** Removes `XFile.fromData`. `XFile`s can no longer be instantiated with a
`Uint8List`. For web, see README for an example to create one from a `Blob`/`File`.
* **Breaking Change** Removes `XFile.saveTo()`. `FileSystemXFile.writeAsBytes` has been added
and the web implementation can use `WebScopedStorageXFileExtension.download`. See README to see
how to access platform-specific feature.
* **Breaking Change** Removes `XFile.mimeType`.
* **Breaking Change** Removes `XFile.path`. This has been replaced by `FileSystemXFile.path`.
* **Breaking Change** Changes `XFile.name` to return `Future<String>` rather than `String`.

## 0.3.5+4

* Adds a runnable `main` entry point and an additional `XFile.fromData`
Expand Down
File renamed without changes.
108 changes: 108 additions & 0 deletions packages/cross_file/cross_file/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# cross_file

An abstraction to allow working with files across multiple platforms.

<?code-excerpt path-base="example/lib"?>

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

| | Android | iOS | Linux | macOS | Web | Windows |
|-------------|---------|---------|-------|--------|-----|-------------|
| **Support** | SDK 24+ | iOS 13+ | Any | 10.15+ | Any | Windows 10+ |

## Usage

Instantiate a `XFile` using a uri or path and use its methods and properties to access the file and
its metadata.

Example:

<?code-excerpt "readme_excerpts.dart (Instantiate)"?>
```dart
final file = XFile.fileSystem(path: 'assets/hello.txt');

debugPrint('File information:');
debugPrint('- URI: ${file.uri}');
debugPrint('- Name: ${await file.name()}');

if (await file.exists()) {
final String fileContent = await file.readAsString();
debugPrint('Content of the file: $fileContent');
}
```

You can find links to the API docs on the [pub page](https://pub.dev/packages/cross_file).

### Implementation-Specific Features

Classes in this package contain an underlying platform implementation that provides features that
are specific to an implementation.

To access implementation-specific features, start by adding the platform implementation packages to
your app or package:

* **dart:io** [cross_file_io](https://pub.dev/packages/cross_file_io/install)
* **Android Scoped Storage**: [cross_file_android](https://pub.dev/packages/cross_file_android/install)
* **iOS/macOS App Sandbox**: [cross_file_darwin](https://pub.dev/packages/cross_file_darwin/install)
* **Web**: [cross_file_web](https://pub.dev/packages/cross_file_web/install)

Next, add the imports of the implementation packages to your app or package:

<?code-excerpt "readme_excerpts.dart (platform_imports)"?>
```dart
// Import for Darwin App Sandbox features.
import 'package:cross_file_darwin/cross_file_darwin.dart';
// Import for Web features.
import 'package:cross_file_web/cross_file_web.dart';
```

Now, additional features can be accessed through the platform implementations. Classes
[FileSystemXFile], [FileSystemXDirectory], [ScopedStorageXFile], and [ScopedStorageXDirectory] pass
their functionality to a class provided by the current platform. Below are a couple of ways to
access additional functionality provided by the platform and is followed by an example.

1. Pass a creation params class provided by a platform implementation to a `fromCreationParams`
constructor (e.g. `XFile.fromCreationParams`, `XDirectory.fromCreationParams`, etc.).
2. Call methods on an implementation of a class by using `getExtension` method (e.g.
`XFile.getExtension`, `XDirectory.getExtension`, etc.).

Below is an example of using additional iOS/macOS and Web features for a `XFile`.

<?code-excerpt "readme_excerpts.dart (platform_features)"?>
```dart
late final XFile file;

switch (CrossFile.implementation) {
case CrossFileWeb():
final params = WebScopedStorageXFileCreationParams.fromObjectUrl(
objectUrl: 'blob:https://some/url:for/file',
);
file = ScopedStorageXFile.fromCreationParams(params);
case CrossFileDarwin():
file = ScopedStorageXFile.fromUri(Uri.file('/my/file.txt'));
default:
file = XFile.fileSystem(path: '/my/file.txt');
}

await file
.getExtension<SecurityScopedDarwinScopedStorageXFileExtension>()
?.startAccessingSecurityScopedResource();

debugPrint(await file.readAsString());

await file
.getExtension<SecurityScopedDarwinScopedStorageXFileExtension>()
?.stopAccessingSecurityScopedResource();
```

See https://pub.dev/documentation/cross_file_darwin/latest/cross_file_darwin/cross_file_darwin-library.html
for more details on iOS/macOS App Sandbox features.

See https://pub.dev/documentation/cross_file_android/latest/cross_file_android/cross_file_android-library.html
for more details on Android Scoped Storage features.

See https://pub.dev/documentation/cross_file_io/latest/cross_file_io/cross_file_io-library.html
for more details on `dart:io` features.

See https://pub.dev/documentation/cross_file_web/latest/cross_file_web/cross_file_web-library.html
for more details on Web features.
3 changes: 3 additions & 0 deletions packages/cross_file/cross_file/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# cross_file_example

Demonstrates how to use the cross_file plugin.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
plugins {
id("com.android.application")
id("dev.flutter.flutter-gradle-plugin")
}

android {
namespace = "dev.flutter.packages.crossfileexample"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

defaultConfig {
applicationId = "dev.flutter.packages.crossfileexample"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
signingConfig = signingConfigs.getByName("debug")
}
}
lint {
disable.add("InvalidPackage")
}
}

kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}

flutter {
source = "../.."
}

dependencies {
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test:runner:1.2.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0")
api("androidx.test:core:1.4.0")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package dev.flutter.packages.crossfileexample

import androidx.test.rule.ActivityTestRule
import dev.flutter.plugins.integration_test.FlutterTestRunner
import io.flutter.plugins.DartIntegrationTest
import org.junit.Rule
import org.junit.runner.RunWith

@DartIntegrationTest
@RunWith(FlutterTestRunner::class)
class MainActivityTest {
@JvmField @Rule var rule = ActivityTestRule(MainActivity::class.java)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<application android:usesCleartextTraffic="true">
<activity
android:name="dev.flutter.packages.crossfileexample.DriverExtensionActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.Entrypoint"
android:value="integrationTestMain" />
</activity>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="cross_file_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.

In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package dev.flutter.packages.crossfileexample

import io.flutter.embedding.android.FlutterActivity

/** Test Activity that sets the name of the Dart method entrypoint in the manifest. */
class DriverExtensionActivity : FlutterActivity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package dev.flutter.packages.crossfileexample

import io.flutter.embedding.android.FlutterActivity

class MainActivity : FlutterActivity()
Loading
Loading