cross_file 0.3.2 copy "cross_file: ^0.3.2" to clipboard
cross_file: ^0.3.2 copied to clipboard

outdated

An abstraction to allow working with files across multiple platforms.

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:

import 'package:cross_file/cross_file.dart';

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

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

final fileContent = await file.readAsString();
print('Content of the file: ${fileContent}');  // e.g. "Moto G (4)"

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

218
likes
0
pub points
99%
popularity

Publisher

verified publisherflutter.dev

An abstraction to allow working with files across multiple platforms.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, js, meta

More

Packages that depend on cross_file