addFile method
- dynamic file
Adds a file to IPFS using chunked streaming.
file should be a dart:html File object or similar (dynamic to avoid import issues).
This method is designed for web usage.
Implementation
Future<CID> addFile(dynamic file) async {
if (_platform.isWeb) {
if (file is Stream<List<int>>) {
return addStream(file);
}
throw UnimplementedError(
'addFile expecting Stream<List<int>>. Use addStream(file.stream()) instead.',
);
}
throw UnimplementedError('addFile only supported on Web');
}