文件最后提交记录最后更新时间
Update repo for 3.32 stable (#9311) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.32 stable release (except the first one, as the stable roller has already landed).11 个月前
[web] Removes a few deprecated API usages. (#6177) This PR removes a bunch of deprecated APIs from the following packages: * web_benchmarks * file_selector_web * cross_file * image_picker_platform_interface ## Issues * Fixes https://github.com/flutter/flutter/issues/143113 * Fixes https://github.com/flutter/flutter/issues/143399 * Fixes https://github.com/flutter/flutter/issues/143878 * Fixes https://github.com/flutter/flutter/issues/143892 * Closes https://github.com/flutter/packages/pull/52482 年前
[web] Removes a few deprecated API usages. (#6177) This PR removes a bunch of deprecated APIs from the following packages: * web_benchmarks * file_selector_web * cross_file * image_picker_platform_interface ## Issues * Fixes https://github.com/flutter/flutter/issues/143113 * Fixes https://github.com/flutter/flutter/issues/143399 * Fixes https://github.com/flutter/flutter/issues/143878 * Fixes https://github.com/flutter/flutter/issues/143892 * Closes https://github.com/flutter/packages/pull/52482 年前
Standardize copyright author and year (#338) Standardize copyright author ("The Flutter Authors") and year (2013), as was previously done in flutter/plugins. Adds per-package AUTHORS files to ensure that published packages contain the authorship information referred to in the boilerplate (again, as in flutter/plugins). First preparatory step in enabling the automated license format check in this repository.4 年前
Update repo for 3.32 stable (#9311) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.32 stable release (except the first one, as the stable roller has already landed).11 个月前
Standardize copyright author and year (#338) Standardize copyright author ("The Flutter Authors") and year (2013), as was previously done in flutter/plugins. Adds per-package AUTHORS files to ensure that published packages contain the authorship information referred to in the boilerplate (again, as in flutter/plugins). First preparatory step in enabling the automated license format check in this repository.4 年前
[cross_file] adopt code excerpts in README (#5347) Updates the README to use a compiled excerpt source for its example of instantiating an XFile. Part of [flutter/flutter#102679](https://github.com/flutter/flutter/issues/102679)2 年前
[cross_file] Add run_tests.dart (and remove install_chromium_for_benchmarks.sh) (#1756) 3 年前
Update repo for 3.32 stable (#9311) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.32 stable release (except the first one, as the stable roller has already landed).11 个月前
README.md

cross_file

An abstraction to allow working with files across multiple platforms.

Usage

Import package:cross_file/cross_file.dart, instantiate a XFile using a path or byte array and use its methods and properties to access the file and its metadata.

Example:

final XFile file = XFile('assets/hello.txt');

print('File information:');
print('- Path: ${file.path}');
print('- Name: ${file.name}');
print('- MIME type: ${file.mimeType}');

final String fileContent = await file.readAsString();
print('Content of the file: $fileContent');

You will find links to the API docs on the pub page.

Web Limitations

XFile on the web platform is backed by Blob objects and their URLs.

It seems that Safari hangs when reading Blobs larger than 4GB (your app will stop without returning any data, or throwing an exception).

This package will attempt to throw an Exception before a large file is accessed from Safari (if its size is known beforehand), so that case can be handled programmatically.

Browser compatibility

Data on Global support for Blob constructing

Data on Global support for Blob URLs

Testing

This package supports both web and native platforms. Unit tests need to be split in two separate suites (because native code cannot use dart:html, and web code cannot use dart:io).

When adding new features, it is likely that tests need to be added for both the native and web platforms.

Native tests

Tests for native platforms are located in the x_file_io_test.dart. Tests can be run with dart test.

Web tests

Tests for the web platform live in the x_file_html_test.dart. They can be run with dart test -p chrome.