Repository navigation
Release 14.0.0: migrate to cross_file 0.4.0 and remove web reading options #2236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
vicajilau
wants to merge
10
commits into
main
Choose a base branch
from
feat/v14-cross-file-0.4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+373
−501
Draft
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f70c79c
Migrate native platforms to cross_file 0.4.0
vicajilau 90bb629
Remove eager reading options on web and read through cross_file
vicajilau f863c12
Prepare the 14.0.0 release
vicajilau 1ccb7d0
Merge branch 'main' into feat/v14-cross-file-0.4
vicajilau 793e8ed
Merge branch 'main' into feat/v14-cross-file-0.4
vicajilau 0005210
Stream web files in evenly sized chunks
vicajilau 59d2b78
Merge branch 'main' into feat/v14-cross-file-0.4
vicajilau 9ced346
Update packages/file_picker/CHANGELOG.md
vicajilau 476d9a4
Address review feedback on the 14.0.0 release
vicajilau 4ca727a
Merge branch 'main' into feat/v14-cross-file-0.4
vicajilau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/file_picker_android/test/platform_file_read_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import 'dart:convert'; | ||
| import 'dart:io'; | ||
|
|
||
| import 'package:cross_file/cross_file.dart'; | ||
| import 'package:cross_file_io/cross_file_io.dart'; | ||
| import 'package:android_file_picker/android_file_picker.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| void main() { | ||
| late Directory dir; | ||
| late String path; | ||
|
|
||
| setUpAll(CrossFileIO.registerWith); | ||
|
|
||
| setUp(() { | ||
| dir = Directory.systemTemp.createTempSync('file_picker_test'); | ||
| path = '${dir.path}${Platform.pathSeparator}notes.txt'; | ||
| File(path).writeAsStringSync('hello file_picker'); | ||
| }); | ||
|
|
||
| tearDown(() => dir.deleteSync(recursive: true)); | ||
|
|
||
| test('reads a picked file through cross_file', () async { | ||
| final file = AndroidPlatformFile.fromMap({ | ||
| 'path': path, | ||
| 'name': 'notes.txt', | ||
| }); | ||
|
|
||
| expect(file.xFile, isA<FileSystemXFile>()); | ||
| expect((file.xFile as FileSystemXFile).path, path); | ||
| expect(utf8.decode(await file.readAsBytes()), 'hello file_picker'); | ||
| expect( | ||
| utf8.decode(await file.readAsByteStream().expand((c) => c).toList()), | ||
| 'hello file_picker', | ||
| ); | ||
| expect(await file.length(), 17); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/file_picker_darwin/test/platform_file_read_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import 'dart:convert'; | ||
| import 'dart:io'; | ||
|
|
||
| import 'package:cross_file/cross_file.dart'; | ||
| import 'package:cross_file_io/cross_file_io.dart'; | ||
| import 'package:file_picker_darwin/file_picker_darwin.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| void main() { | ||
| late Directory dir; | ||
| late String path; | ||
|
|
||
| setUpAll(CrossFileIO.registerWith); | ||
|
|
||
| setUp(() { | ||
| dir = Directory.systemTemp.createTempSync('file_picker_test'); | ||
| path = '${dir.path}${Platform.pathSeparator}notes.txt'; | ||
| File(path).writeAsStringSync('hello file_picker'); | ||
| }); | ||
|
|
||
| tearDown(() => dir.deleteSync(recursive: true)); | ||
|
|
||
| test('reads a picked file through cross_file', () async { | ||
| final file = DarwinPlatformFile.fromMap({ | ||
| 'path': path, | ||
| 'name': 'notes.txt', | ||
| }); | ||
|
|
||
| expect(file.xFile, isA<FileSystemXFile>()); | ||
| expect((file.xFile as FileSystemXFile).path, path); | ||
| expect(utf8.decode(await file.readAsBytes()), 'hello file_picker'); | ||
| expect( | ||
| utf8.decode(await file.readAsByteStream().expand((c) => c).toList()), | ||
| 'hello file_picker', | ||
| ); | ||
| expect(await file.length(), 17); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latter one is a content URI, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly! Anything outside the
filescheme is a Storage Access Frameworkcontent://URI. I documented it on the getter in 476d9a4 so it doesn't need explaining again 🙂