uri_content
4.0.1, released 4 months ago by an unverified publisher
Fetch Uint8List from a Uri without creating temporary files
What it does
This package reads bytes directly from a Uri and returns them as a Uint8List. It supports data, file, http, https and Android content schemes, and can stream large files in chunks.
AI-written summary of version 4.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- Need to download binary data from a network or file Uri
- Want to avoid temporary files on disk
- Need custom headers or a mockable HTTP client
- Testing requires a controllable source
Skip it when
- Fetching very large files with the from() method (use getContentStream instead)
- Using unsupported schemes (e.g., ftp)
Strengths
- No temp files, minimal disk usage
- Supports multiple schemes including Android content URIs
- Stream API for large files
- Customizable HTTP client and headers
Weaknesses
- from() can crash on large files if memory is insufficient
- Requires Android permissions for content scheme (READ_EXTERNAL_STORAGE)
- No built‑in retry logic
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'dart:typed_data';
import 'package:uri_content/uri_content.dart';
Future<Uint8List> loadBytes() async {
final uri = Uri.parse('https://example.com/file.bin');
return await uri.getContent();
}Alternatives
Packages that do the same job and could replace uri_content.